<commit_before>'use strict';

/**
 * @name worker
 * @description job worker process for open311 API
 *
 * Alert!: Please ensure your have installed Redis Server
 * 
 * Alert!: Run worker in the separate process from main process
 *
 * Recommendation!: It also adviced to run each worker per process or per machine
 * with any number of concurrency(10 is sufficient max worker so far) 
 */


//set environment to development by default
if (!(process.env || {}).NODE_ENV) {
  process.env.NODE_ENV = 'development';
}


//suppress configuration warning
process.env.SUPPRESS_NO_CONFIG_WARNING = true;


//dependencies
const path = require('path');
const config = require('config'); //load configurations
const environment = require('execution-environment');
const mkdir = require('mkdir-p');
const kue = require('kue');


//register environment variables
environment.registerEnvironments({
  isLocal: ['test', 'dev', 'development']
});


//build logs directory if does not exists
mkdir.sync(path.join(__dirname, '..', 'logs'));


//setup application mongoose instance
require(path.join(__dirname, 'app', 'initializers', 'mongoose'));

//------------------------------------------------------------------------
// Transports Initialization & Run
//------------------------------------------------------------------------

//initialize infobip sms transport
const infobip = require('open311-infobip');
let infobipOptions = config.get('infobip');
if (process.env.REDIS_URL) {
  infobipOptions.redis = process.env.REDIS_URL;
}
infobip.options = infobipOptions;


//start
infobip.start();


//initialize mongoose-kue to run schema methods in background<commit_msg>try fix worker log path<commit_after>'use strict';

/**
 * @name worker
 * @description job worker process for open311 API
 *
 * Alert!: Please ensure your have installed Redis Server
 * 
 * Alert!: Run worker in the separate process from main process
 *
 * Recommendation!: It also adviced to run each worker per process or per machine
 * with any number of concurrency(10 is sufficient max worker so far) 
 */


//set environment to development by default
if (!(process.env || {}).NODE_ENV) {
  process.env.NODE_ENV = 'development';
}


//suppress configuration warning
process.env.SUPPRESS_NO_CONFIG_WARNING = true;


//dependencies
const path = require('path');
const config = require('config'); //load configurations
const environment = require('execution-environment');
const mkdir = require('mkdir-p');
const kue = require('kue');


//register environment variables
environment.registerEnvironments({
  isLocal: ['test', 'dev', 'development']
});


//build logs directory if does not exists
const logPath = path.join(__dirname, 'logs');
mkdir.sync(logPath);


//setup application mongoose instance
require(path.join(__dirname, 'app', 'initializers', 'mongoose'));

//------------------------------------------------------------------------
// Transports Initialization & Run
//------------------------------------------------------------------------

//initialize infobip sms transport
const infobip = require('open311-infobip');
let infobipOptions = config.get('infobip');
if (process.env.REDIS_URL) {
  infobipOptions.redis = process.env.REDIS_URL;
}
infobip.options = infobipOptions;


//start
infobip.start();


//initialize mongoose-kue to run schema methods in background
{'fraction_non_alphanumeric': 0.20035938903863432, 'fraction_numerical': 0.004791853848457622, 'mean_word_length': 3.0831295843520783, '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': '2420838', 'n_tokens_mistral': 916, 'n_tokens_neox': 871, 'n_words': 288}