<commit_before>var _ = require('underscore');
var async = require('async');
var logger = require('./loggingservice.js');
var api = require('./api.js');

var downloader = function(refreshInterval){

  this.refreshInterval = refreshInterval;
  this.noTradesCount = 0;

  _.bindAll(this, 'start', 'stop', 'processTrades');

};

//---EventEmitter Setup
var Util = require('util');
var EventEmitter = require('events').EventEmitter;
Util.inherits(downloader, EventEmitter);
//---EventEmitter Setup

downloader.prototype.processTrades = function(err, trades) {

  if(!err) {

    this.noTradesCount = 0;

    this.emit('update', trades);

  } else {

    this.noTradesCount += 1;

    if(this.noTradesCount >= 30) {
      logger.error('Haven\'t received data from the API for 30 consecutive attempts, stopping qpplication');
      return process.exit();
    }
    
  }<commit_msg>Fixed typo in dataretriever.js<commit_after>var _ = require('underscore');
var async = require('async');
var logger = require('./loggingservice.js');
var api = require('./api.js');

var downloader = function(refreshInterval){

  this.refreshInterval = refreshInterval;
  this.noTradesCount = 0;

  _.bindAll(this, 'start', 'stop', 'processTrades');

};

//---EventEmitter Setup
var Util = require('util');
var EventEmitter = require('events').EventEmitter;
Util.inherits(downloader, EventEmitter);
//---EventEmitter Setup

downloader.prototype.processTrades = function(err, trades) {

  if(!err) {

    this.noTradesCount = 0;

    this.emit('update', trades);

  } else {

    this.noTradesCount += 1;

    if(this.noTradesCount >= 30) {
      logger.error('Haven\'t received data from the API for 30 consecutive attempts, stopping application');
      return process.exit();
    }

  }
{'fraction_non_alphanumeric': 0.15275411697898922, 'fraction_numerical': 0.007950028392958546, 'mean_word_length': 4.077809798270893, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5363781', 'n_tokens_mistral': 563, 'n_tokens_neox': 538, 'n_words': 125}