/srv/irclogs.ubuntu.com/2022/05/15/#ubuntustudio-devel.txt

OvenWerksEickmeyer: I can find both python3-flufl.lock and python3-lockfile in our packages. Lockfile has a ubuntu logo beside it and flufl does not. I am assuming that means lockfile is to be prefered? (is in main)15:28
OvenWerkshowever, this post here https://stackoverflow.com/questions/489861/locking-a-file-in-python# (fourth answer down) calls lockfile deprecated. I will note that this answer is from 2015 so maybe it has been updated since?15:31
OvenWerksAh, there is also oslo.concurrency which suppercedes lockfile and is also in main.15:38
OvenWerksIt does not give easy to use examples... I guess it is very capable and can keep track of many files but it looks hard to use to lock one file15:56
OvenWerksEickmeyer: Scratch adding another package. I think I will use a two file system. Write to a temp using flock() so only one can write at a time. A reading method will look for the temp file and wait till it goes away before reading. If it starts reading just before the temp file shows up for writing, that should be ok as it will have to to fully read (writing may have a short delay to make 21:16
OvenWerkssure)21:16
OvenWerkss/to to/time to/21:19
OvenWerksthen remove the config file which will not be a problem as the temp file still exists acting as a blocker. The mv the tempfile to the config file which an atomic process.21:21

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!