tardis-dev / tardis-node

Convenient access to tick-level real-time and historical cryptocurrency market data via Node.js
https://docs.tardis.dev/api/node-js
Mozilla Public License 2.0
293 stars 65 forks source link

Bug: replay temp file leak when SIGINT terminated #27

Closed hackape closed 4 years ago

hackape commented 4 years ago

https://github.com/tardis-dev/tardis-node/blob/69006db94d0aadcbb51196c8f12f1c7784b89b5d/src/handy.ts#L283-L337

When replay.ts call worker.terminate(), it's a basically force kill. Thus the finally branch in handy.ts/_downloadFile() is not executed in worker thread.

When process is SIGINT terminated, cacheDir ended up being littered by tons of .unconfirmed temp files.