<commit_before>'use strict';
process.on('message', handleMessages);

var Dropbox = require('dropbox');
var options;

// delayTime in seconds;
var delayTime = 10;
delayTime *= 1000;
var queue = {};

function addToDropboxQueue (message) {
  var bin = message.bin;
  var user = message.user;
  var fileContent = fileFromBin(bin);
  var id = bin.url;
  var saveObject = {
    file: fileContent,
    token: user.dropbox_token, // jshint ignore:line
    timeout: setTimeout(function(){
      saveToDropBox(fileContent, fileNameFromBin(bin), user);
    }, delayTime)
  };
  if (queue[id]) {
    clearTimeout(queue[id].timeout);
  }
  log('adding to queue');
  queue[id] = saveObject;
}

function saveToDropBox (file, name, user) {
  log('actually saving it now');
  var client = new Dropbox.Client({
    key: options.id,
    secret: options.secret,
    token: user.dropbox_token // jshint ignore:line
  });

  client.writeFile(name, file, function (err) {
    if (err) {
      process.send({
        error: err,
        user: user
      });
    }
    log('saved!');
  });

}

function fileNameFromBin (bin) {
  return bin.url + '.html';<commit_msg>Remove compilation of file out of dropbox module dropbox module will be passed a file a name and a user and save that with no other logic<commit_after>'use strict';
process.on('message', handleMessages);

var Dropbox = require('dropbox');
var options;

// delayTime in seconds;
var delayTime = 10;
delayTime *= 1000;
var queue = {};

function addToDropboxQueue (message) {
  var user = message.user;
  var fileContent = message.file;
  var fileName = message.fileName;
  var saveObject = {
    file: fileContent,
    token: user.dropbox_token, // jshint ignore:line
    timeout: setTimeout(function(){
      saveToDropBox(fileContent, fileName, user);
    }, delayTime)
  };
  if (queue[id]) {
    clearTimeout(queue[id].timeout);
  }
  log('adding to queue');
  queue[id] = saveObject;
}

function saveToDropBox (file, name, user) {
  log('actually saving it now');
  var client = new Dropbox.Client({
    key: options.id,
    secret: options.secret,
    token: user.dropbox_token // jshint ignore:line
  });

  client.writeFile(name, file, function (err) {
    if (err) {
      process.send({
        error: err,
        user: user
      });
    }
    log('saved!');
  });

}

function fileNameFromBin (bin) {
  return bin.url + '.html';
{'fraction_non_alphanumeric': 0.13529411764705881, 'fraction_numerical': 0.005042016806722689, 'mean_word_length': 3.352833638025594, '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': '4512687', 'n_tokens_mistral': 776, 'n_tokens_neox': 767, 'n_words': 212}