<commit_before>// Generated by CoffeeScript 1.6.3
(function() {
  var Sidekiq, crypto;

  crypto = require("crypto");

  Sidekiq = (function() {
    var generateJobId, getQueueName;

    generateJobId = function(cb) {
      return crypto.randomBytes(12, function(err, buf) {
        if (err != null) {
          return cb(err);
        }
        return cb(null, buf.toString("hex"));
      });
    };

    getQueueName = function(queueName) {
      return queueName || "default";
    };

    function Sidekiq(redisConnection, namespace) {
      this.redisConnection = redisConnection;
      this.namespace = namespace;
    }

    Sidekiq.prototype.namespaceKey = function(key) {
      if (this.namespace != null) {
        return "" + this.namespace + ":" + key;
      } else {
        return key;
      }
    };

    Sidekiq.prototype.getQueueKey = function(queueName) {
      return this.namespaceKey("queue:" + (getQueueName(queueName)));
    };

    Sidekiq.prototype.enqueue = function(workerClass, args, payload) {
      var _this = this;
      return generateJobId(function(err, jid) {
        payload["class"] = workerClass;
        payload.args = args;
        payload.jid = jid;
        if (payload.at instanceof Date) {
          payload.at = payload.at.getTime() / 1000;
          return _this.redisConnection.zadd(_this.namespaceKey("schedule"), payload.at, JSON.stringify(payload));
        } else {
          _this.redisConnection.lpush(_this.getQueueKey(payload.queue), JSON.stringify(payload));
          return _this.redisConnection.sadd(_this.namespaceKey("queues"), getQueueName(payload.queue));
        }
      });
    };
<commit_msg>add callback/error handling to #enqueue<commit_after>// Generated by CoffeeScript 1.6.3
(function() {
  var Sidekiq, crypto;

  crypto = require("crypto");

  Sidekiq = (function() {
    var generateJobId, getQueueName;

    generateJobId = function(cb) {
      return crypto.randomBytes(12, function(err, buf) {
        if (err != null) {
          return cb(err);
        }
        return cb(null, buf.toString("hex"));
      });
    };

    getQueueName = function(queueName) {
      return queueName || "default";
    };

    function Sidekiq(redisConnection, namespace) {
      this.redisConnection = redisConnection;
      this.namespace = namespace;
    }

    Sidekiq.prototype.namespaceKey = function(key) {
      if (this.namespace != null) {
        return "" + this.namespace + ":" + key;
      } else {
        return key;
      }
    };

    Sidekiq.prototype.getQueueKey = function(queueName) {
      return this.namespaceKey("queue:" + (getQueueName(queueName)));
    };

    Sidekiq.prototype.enqueue = function(workerClass, args, payload, _cb) {
      var _this = this,
          cb = _cb || function() {};
      return generateJobId(function(err, jid) {
        payload["class"] = workerClass;
        payload.args = args;
        payload.jid = jid;
        if (payload.at instanceof Date) {
          payload.at = payload.at.getTime() / 1000;
          return _this.redisConnection.zadd(_this.namespaceKey("schedule"), payload.at, JSON.stringify(payload), cb);
        } else {
          _this.redisConnection.lpush(_this.getQueueKey(payload.queue), JSON.stringify(payload), function(err) {
            if (err) {
              cb(err)
            } else {
              return _this.redisConnection.sadd(_this.namespaceKey("queues"), getQueueName(payload.queue), cb);
            }
          });
        }
      });
    };

{'fraction_non_alphanumeric': 0.1331809088310946, 'fraction_numerical': 0.005144326950557302, 'mean_word_length': 2.4516765285996054, 'pattern_counts': {'":': 2, '<': 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': '2071155', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1026, 'n_words': 197}