<commit_before>var async = require('async'),
    checkForFiling = require('./check'),
    request = require('request'),
    models = require('../../models');

var lookBehind = 100,
    interval = 60000;

function queueFilingsToCheck() {
    console.log('checking API');

    models.fec_filing.findAll({
            attributes: ['filing_id'],
            limit: lookBehind,
            order: [
                ['filing_id', 'DESC']
            ]
        })
        .then(function(filings) {
            filings = filings.map(function(filing) {
                return filing.filing_id;
            });

            request('https://api.open.fec.gov/v1/efile/filings/?sort=-receipt_date&per_page=' +
                    lookBehind + '&api_key=' + process.env.FEC_KEY +
                    '&page=1', function (error, response, body) {
                if (!error && response.statusCode == 200) {
                    var data = JSON.parse(body);

                    if (data && data.results) {

                        var tasks = [];

                        data.results.forEach(function (filing) {
                            if (filings.indexOf(filing.file_number) === -1) {
                                tasks.push(filing.file_number);
                            }
                        });

                        console.log(tasks);

                        async.mapSeries(tasks, checkForFiling, function () {
                            console.log('waiting');
                            setTimeout(queueFilingsToCheck,interval);
                        });
                    }<commit_msg>Changed logging<commit_after>var async = require('async'),
    checkForFiling = require('./check'),
    request = require('request'),
    models = require('../../models');

var lookBehind = 100,
    interval = 60000;

function queueFilingsToCheck() {
    console.log('checking API');

    models.fec_filing.findAll({
            attributes: ['filing_id'],
            limit: lookBehind,
            order: [
                ['filing_id', 'DESC']
            ]
        })
        .then(function(filings) {
            filings = filings.map(function(filing) {
                return filing.filing_id;
            });

            request('https://api.open.fec.gov/v1/efile/filings/?sort=-receipt_date&per_page=' +
                    lookBehind + '&api_key=' + process.env.FEC_KEY +
                    '&page=1', function (error, response, body) {
                if (!error && response.statusCode == 200) {
                    var data = JSON.parse(body);

                    if (data && data.results) {

                        var tasks = [];

                        data.results.forEach(function (filing) {
                            console.log(filing.file_number,filings.indexOf(filing.file_number));
                            if (filings.indexOf(filing.file_number) === -1) {
                                tasks.push(filing.file_number);
                            }
                        });

                        async.mapSeries(tasks, checkForFiling, function () {
                            console.log('waiting');
                            setTimeout(queueFilingsToCheck,interval);
                        });
                    }
{'fraction_non_alphanumeric': 0.12507664009809932, 'fraction_numerical': 0.008583690987124463, 'mean_word_length': 1.2946554149085794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1160287', 'n_tokens_mistral': 886, 'n_tokens_neox': 816, 'n_words': 129}