@ -9,6 +9,7 @@ const PID = process.pid;
const DB _PATH = 'lib/workers/db-worker' ;
const MAX _JOBS = 16 ;
const DEFAULT _QUERY _TIMEOUT = 60000 * 15 ; // increased from three to fifteen minutes because queries for very large files were taking as long as seven minutes
Workers . initialize = function ( Env , config , _cb ) {
var cb = Util . once ( Util . mkAsync ( _cb ) ) ;
@ -113,6 +114,7 @@ Workers.initialize = function (Env, config, _cb) {
const txid = guid ( ) ;
var cb = Util . once ( Util . mkAsync ( Util . both ( _cb , function ( err /*, value */ ) {
if ( err !== 'TIMEOUT' ) { return ; }
Log . debug ( "WORKER_TIMEOUT_CAUSE" , msg ) ;
// in the event of a timeout the user will receive an error
// but the state used to resend a query in the event of a worker crash
// won't be cleared. This also leaks a slot that could be used to keep
@ -132,7 +134,7 @@ Workers.initialize = function (Env, config, _cb) {
state . tasks [ txid ] = msg ;
// default to timing out affter 180s if no explicit timeout is passed
var timeout = typeof ( opt . timeout ) !== 'undefined' ? opt . timeout : 180000 ;
var timeout = typeof ( opt . timeout ) !== 'undefined' ? opt . timeout : DEFAULT _QUERY _TIMEOUT ;
response . expect ( txid , cb , timeout ) ;
state . worker . send ( msg ) ;
} ;