File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 2424
2525import json
2626import logging
27+ import os
2728import random
2829import time
2930import zipfile
@@ -280,13 +281,13 @@ def refresh_has_metakg():
280281refresh = refresh_document
281282check = check_uptime
282283
283- # only one process should perform backup routines
284- _lock = FileLock (".lock" , timeout = 0 )
285-
286284
287285def routine (no_backup = False , format = "zip" ):
288286 logger = logging .getLogger ("routine" )
289287
288+ # only one process should perform backup routines
289+ _lock = FileLock (".lock" , timeout = 0 )
290+
290291 # Add jitter: random delay between 100 and 500 milliseconds (adjust range as needed)
291292 jitter_ms = random .uniform (100 , 500 ) # Jitter in milliseconds
292293 jitter_seconds = jitter_ms / 1000 # Convert milliseconds to seconds
@@ -326,6 +327,15 @@ def routine(no_backup=False, format="zip"):
326327 _lock .release ()
327328 logger .info ("Schedule lock released successfully." )
328329
330+ # Try to delete the .lock file manually if it still exists
331+ lock_file_path = ".lock"
332+ if os .path .exists (lock_file_path ):
333+ try :
334+ os .remove (lock_file_path )
335+ logger .info (".lock file manually deleted." )
336+ except Exception as e :
337+ logger .warning (f"Could not delete .lock file: { e } " )
338+
329339
330340if __name__ == "__main__" :
331341 restore_from_s3 ()
You can’t perform that action at this time.
0 commit comments