I receive the Max call stack size exceeded after ~20 loops in series of my program.
Normally I would call process.nextTick to clear my stack when running a big loop in series.
Here is the code I am using. Shouldn't this prevent any call stack issue or am I doing something wrong?
for actData in acts
break if actData.files?
await asyncFunction defer e, data
return done e if e
actData.files = data.files
await process.nextTick defer()
The error is not correlated with a particular element in the array - I have received the error on different elements when running the function from different contexts.
When I replace it with code using the async library it still fails. Code can be found below:
fn = (done) ->
async.eachSeries acts, (actData, cb) ->
return cb() if actData.files?
ComLaw.downloadAct actData.ComlawId,
downloadDir: downloadedFilesDir
, (e, data) ->
return cb e if e
# Path to downloaded files. HTML or RTF.
actData.files = data.files
process.nextTick cb
, done
await fn defer e
return done e if e
I receive the
Max call stack size exceeded
after ~20 loops in series of my program.Normally I would call
process.nextTick
to clear my stack when running a big loop in series.Here is the code I am using. Shouldn't this prevent any call stack issue or am I doing something wrong?
The error is not correlated with a particular element in the array - I have received the error on different elements when running the function from different contexts.
When I replace it with code using the
async
library it still fails. Code can be found below:If I change it to
async.each
it still happens.