3 ms·
They're using readFileSync? Doesn't this lock up the thread?
by adamredwoods 6y ago
They're using readFileSync? Doesn't this lock up the thread?
- mbreese 6y agoIt’s been awhile since I’ve looked at JavaScript like this, but I would guess that the thread lock would only exist so long as the read() call is running. That returns and then the write is initiated. It doesn’t look like there is a lock that exists throughout the update callback. If that’s missing, then if you had two threads/processes operating on the same table, you’d all but guarantee one of those update calls would be lost (in the best case scenario). Or maybe there a different locking mechanism in place that my cursory look missed?
- jsf01 6y agoYes. They’re also using fs.exists in the exact way that the official documentation says not to use it.