Wednesday, 19 August 2020

Chokidar question

I watch a very fast changing process that produces a small file. Process is hooked from hardware.The file is truncated to produce a single json value (vs reading the last line of a huge file). Clients subscribe to this status via websocket. The user then sees it in the browser.Chokidar fires on file change, sometimes by the time I read it and send it back it is already truncated, and I get an empty response. What would be optimal settings for awaitWriteFinish? I think in the deep loop the file may change in microseconds.Plan B is to write this file every 50 or so iterations. I don't think this can keep up in real time (I don't really need it to, I could also ignore the blanks, just looking for a best practice).

Submitted August 20, 2020 at 01:09AM by ernst_starvo_blofeld

No comments:

Post a Comment