I wish to use shelve in an asyncio program and I fear that every change will cause the main event loop to stall.
While I don’t mind the occasional slowdown of the pickling operation, the disk writes may be substantial.
Every how often does shelve sync to disk? Is it a blocking operation? Do I have to call .sync()
?
If I schedule the sync()
to run under a different thread, a different asyncio task may modify the shelve at the same time, which violates the premise of single-thread writes.