<commit_before>'use strict';

function QueueSeeker(pool) {
    this.db = 5;
    this.channel = 'batch:hosts';
    this.redisPrefix = 'batch:queues:';
    this.pattern = this.redisPrefix + '*';
    this.pool = pool;
}

module.exports = QueueSeeker;

QueueSeeker.prototype.seek = function (onMessage, callback) {
    var initialCursor = ['0'];
    this.onMessage = console.log.bind(console);

    this._seek(initialCursor, callback);
};

QueueSeeker.prototype._seek = function (cursor, callback) {
    var self = this;
    var redisParams = [cursor[0], 'MATCH', self.pattern];

    this.pool.acquire(this.db, function(err, client) {
        if (err) {
            return callback(err);
        }

        client.scan(redisParams, function(err, currentCursor) {
            // checks if iteration has ended
            if (currentCursor[0] === '0') {
                self.pool.release(self.db, client);
                return callback(null);
            }

            var queues = currentCursor[1];

            if (!queues) {
                return callback(null);
            }<commit_msg>Use real on message handler<commit_after>'use strict';

function QueueSeeker(pool) {
    this.db = 5;
    this.channel = 'batch:hosts';
    this.redisPrefix = 'batch:queues:';
    this.pattern = this.redisPrefix + '*';
    this.pool = pool;
}

module.exports = QueueSeeker;

QueueSeeker.prototype.seek = function (onMessage, callback) {
    var initialCursor = ['0'];
    this.onMessage = onMessage;

    this._seek(initialCursor, callback);
};

QueueSeeker.prototype._seek = function (cursor, callback) {
    var self = this;
    var redisParams = [cursor[0], 'MATCH', self.pattern];

    this.pool.acquire(this.db, function(err, client) {
        if (err) {
            return callback(err);
        }

        client.scan(redisParams, function(err, currentCursor) {
            // checks if iteration has ended
            if (currentCursor[0] === '0') {
                self.pool.release(self.db, client);
                return callback(null);
            }

            var queues = currentCursor[1];

            if (!queues) {
                return callback(null);
            }
{'fraction_non_alphanumeric': 0.13143382352941177, 'fraction_numerical': 0.0055147058823529415, 'mean_word_length': 2.2736842105263158, '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': '2106247', 'n_tokens_mistral': 670, 'n_tokens_neox': 636, 'n_words': 140}