Re:V8 adds support for top-level await
by asoo on Wednesday September 25, 2019 @03:02AM
(#21068422)
You'd need to lock both accounts... but even then. Doing any kind of accounting operations without being atomic, transactional or idempotent is just wrong. Even with single call - acct2.add() could fail and you're left with broken state.
If this is in-memory state then you don't need asyncs at all. If it's not, Locks just give you false sense of safety.
[ Parent
| on HN ]
There are no comments on this comment yet.