Since each cronjob is run in separated Docker containers, making sure that there is at most one process running at any time with PID file lock does not work (the lock file is not shared). This PR moves PID lock to a db variable table in order to share the lock state among cronjobs. Also the pid lock is changed to use python context manager, which eliminates some edge cases where the lock is not released.
Since each cronjob is run in separated Docker containers, making sure that there is at most one process running at any time with PID file lock does not work (the lock file is not shared). This PR moves PID lock to a db variable table in order to share the lock state among cronjobs. Also the pid lock is changed to use python context manager, which eliminates some edge cases where the lock is not released.