I am trying to debug a quite rare and random timeout on a NodeJs AWS Lambda. To see what processes are still running I'll use packages from this thread How can I get a list of callbacks in the Node work queue? (or, Why won't Node exit?). To avoid useless logs, I want to log callbacks only in the process run for more than 500ms. Is it possible to do that and how ? Thanks
Asked
Active
Viewed 151 times
1 Answers
2
I would use something like
var to = setTimeout(function(){ <log> }, 500); //log in 500ms
And then at the end of command you can do:
clearTimeout(to);
That way it would call log in half a second, unless it lasted less than 500 and called cleartimeout.

darthzejdr
- 314
- 1
- 3
- 12