<commit_before>'use strict';

angular.module('storage-backed-queue', ['storage-backed-object'])
  .factory('StorageBackedQueue', function (StorageBackedObject, $timeout) {
    var timeout = 5 * 1000;
    var queueKey = 'queue';

    var StorageBackedQueue = function (globalName_) {

      /* Private members */

      var globalName = globalName_;
      var storage = StorageBackedObject(globalName);
      var funcs = {};
      var running = false;

      /* Private methods */
      var push, shift, getQueue, saveQueue, runNext;

      push = function (functionId, params) {
        var queue = getQueue();
        queue.push({
          functionId: functionId,
          params: angular.copy(params)
        });
        saveQueue(queue);
      };

      shift = function () {
        var queue = getQueue();
        queue.shift();
        saveQueue(queue);
      };

      getQueue = function () {
        return storage.get(queueKey, []);
      };

      saveQueue = function (queue) {
        return storage.set(queueKey, queue);
      };

      runNext = function () {
        var next = getQueue()[0];
        if (running || !next || !funcs[next.functionId]) {
          return;<commit_msg>Cleanup<commit_after>'use strict';

angular.module('storage-backed-queue', ['storage-backed-object'])
  .factory('StorageBackedQueue', function (StorageBackedObject, $timeout) {
    var timeout = 5 * 1000;
    var queueKey = 'queue';

    var StorageBackedQueue = function (_globalName_) {

      /* Private members */

      var globalName = _globalName_;
      var storage = StorageBackedObject(globalName);
      var funcs = {};
      var running = false;

      /* Private methods */

      var push, shift, getQueue, saveQueue, runNext;

      push = function (functionId, params) {
        var queue = getQueue();
        queue.push({
          functionId: functionId,
          params: angular.copy(params)
        });
        saveQueue(queue);
      };

      shift = function () {
        var queue = getQueue();
        queue.shift();
        saveQueue(queue);
      };

      getQueue = function () {
        return storage.get(queueKey, []);
      };

      saveQueue = function (queue) {
        return storage.set(queueKey, queue);
      };

      runNext = function () {
        var next = getQueue()[0];
        if (running || !next || !funcs[next.functionId]) {
          return;
{'fraction_non_alphanumeric': 0.1302713987473904, 'fraction_numerical': 0.005010438413361169, 'mean_word_length': 2.2032085561497325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6019575', 'n_tokens_mistral': 684, 'n_tokens_neox': 649, 'n_words': 159}