<commit_before>/*jslint node: true */
'use strict';

/* system libs */
var moment = require('moment');

/* app libs */
var queue = require('../lib/queue');
var helpers = require('../lib/helpers')();

/* database models */
var Fanpage = require('../models/fanpage');

/* constantes */
var timeout = 1;
var lastRun = 0;
var nextRun = moment().unix();

/* job tasks */

/* add page info to the queue */
var syncProfilePicture = function(page) {
    var url = page._id + '/picture?width=320&height=320';
    queue.add(page, url, null, syncProfilePictureCallback, [ 'url' ]);
}

/* parse page info callback response */
var syncProfilePictureCallback = function(page, row) {
    Fanpage.update({ _id: row.id }, {
        /* profile picture */
        'facebook.picture': helpers.safeImage(row.url),
        
        /* job status */
        'jobs.update_profile_picture': Date.now()
    }, function(err) {
        if (err) {
            throw 'Error updating output from sync profile picture: ' + err;
        }
    });
};

/* start syncing page contents */
var startSyncing = function (records, callback) {
    var i,
        cur;
    
    if (!callback) {
        throw 'No callback has been supplied for "startSyncing"';
    }
    
    for (i = 0; i < records.length; i += 1) {
        cur = records[i];
        syncProfilePicture(cur);
    }
};<commit_msg>Correção na passagem de argumentos.<commit_after>/*jslint node: true */
'use strict';

/* system libs */
var moment = require('moment');

/* app libs */
var queue = require('../lib/queue');
var helpers = require('../lib/helpers')();

/* database models */
var Fanpage = require('../models/fanpage');

/* constantes */
var timeout = 1;
var lastRun = 0;
var nextRun = moment().unix();

/* job tasks */

/* add page info to the queue */
var syncProfilePicture = function(page) {
    var url = page._id + '/picture';
    queue.add(page, url, 'width=320&height=320', syncProfilePictureCallback, [ 'url' ]);
}

/* parse page info callback response */
var syncProfilePictureCallback = function(page, row) {
    Fanpage.update({ _id: row.id }, {
        /* profile picture */
        'facebook.picture': helpers.safeImage(row.url),
        
        /* job status */
        'jobs.update_profile_picture': Date.now()
    }, function(err) {
        if (err) {
            throw 'Error updating output from sync profile picture: ' + err;
        }
    });
};

/* start syncing page contents */
var startSyncing = function (records, callback) {
    var i,
        cur;
    
    if (!callback) {
        throw 'No callback has been supplied for "startSyncing"';
    }
    
    for (i = 0; i < records.length; i += 1) {
        cur = records[i];
        syncProfilePicture(cur);
    }
};
{'fraction_non_alphanumeric': 0.15694902823615695, 'fraction_numerical': 0.007334066740007334, 'mean_word_length': 2.5706806282722514, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3934128', 'n_tokens_mistral': 860, 'n_tokens_neox': 831, 'n_words': 238}