Closed dron22 closed 6 years ago
@patx nice, to see this change finally being added to the project :+1:
thanks for pointing it out!
@patx and @dron22 the current solution using a signal handler adds a runtime constraint - you can only call pickledb in the main thread because only the main thread is allowed to handle signals. I was trying to use pickledb along with grpc, which spins off side threads to handle rpc requests, and it would not work for that very reason: Exception calling application: signal only works in main thread
In the meantime I made a fork that accepts a new init arg to optionally not set the sig handler.
When a SIGTERM signal (e.g. by hitting Ctrl-C in terminal) is received during dump() execution, the exit is performed immediately which causes corruption of the pickledb database file. This can be very annoying as it might mean the loss of critical data.
Upon execution of load() after a restart, I get this this error:
My pull request will fix this: https://github.com/patx/pickledb/pull/17