diff --git a/server/montytest/api.py b/server/montytest/api.py index e465c165..24e0b7ff 100644 --- a/server/montytest/api.py +++ b/server/montytest/api.py @@ -34,7 +34,7 @@ according to the route/URL mapping defined in `__init__.py`. """ -WORKER_VERSION = 11 +WORKER_VERSION = 12 @exception_view_config(HTTPException) diff --git a/worker/sri.txt b/worker/sri.txt index b2f6a693..76c1162b 100644 --- a/worker/sri.txt +++ b/worker/sri.txt @@ -1 +1 @@ -{"__version": 11, "updater.py": "gSJX/HbsPwsZnUZaFbAgF0zwWPWXv+LEw9jBhJkxFOrCH9CZS0+4U4nE2fJdeNze", "worker.py": "5H/vhWvrKp34ehp12ppQWXr0lYOQT1lHs8qjHg2XX02oLHZtMkO9iyK1IgVCwVqa", "games.py": "SOlAX95oLMYwCKNm/XkK5Uf1WPw1PGeIPzvgZqZ04AHNF2+MQ1vc+blTGu5F0JUZ"} +{"__version": 12, "updater.py": "gSJX/HbsPwsZnUZaFbAgF0zwWPWXv+LEw9jBhJkxFOrCH9CZS0+4U4nE2fJdeNze", "worker.py": "0fvv6AahgRpu9pjF/xgjdVWjRujuecreJJ9Pyw8yyqfLY8aQ+nhZQlLll4/fWj/k", "games.py": "SOlAX95oLMYwCKNm/XkK5Uf1WPw1PGeIPzvgZqZ04AHNF2+MQ1vc+blTGu5F0JUZ"} diff --git a/worker/worker.py b/worker/worker.py index 57648ed8..92277ad0 100644 --- a/worker/worker.py +++ b/worker/worker.py @@ -65,7 +65,7 @@ MIN_CARGO_MAJOR = 1 MIN_CARGO_MINOR = 77 -WORKER_VERSION = 11 +WORKER_VERSION = 12 FILE_LIST = ["updater.py", "worker.py", "games.py"] HTTP_TIMEOUT = 30.0 INITIAL_RETRY_TIME = 15.0 @@ -1172,7 +1172,7 @@ def utcoffset(): return "{}{:02d}:{:02d}".format("+" if utcoffset >= 0 else "-", hh, mm) -def verify_worker_version(remote, username, password): +def verify_worker_version(remote, username, password, worker_lock): # Returns: # True: we are the right version and have the correct credentials # False: incorrect credentials (the user may have been blocked in the meantime) @@ -1191,6 +1191,7 @@ def verify_worker_version(remote, username, password): print("Updating worker version to {}".format(req["version"])) backup_log() try: + worker_lock.release() update() except Exception as e: print( @@ -1211,6 +1212,7 @@ def fetch_and_handle_task( current_state, clear_binaries, global_cache, + worker_lock, ): # This function should normally not raise exceptions. # Unusual conditions are handled by returning False. @@ -1225,7 +1227,7 @@ def fetch_and_handle_task( ) # Check the worker version and upgrade if necessary - ret = verify_worker_version(remote, worker_info["username"], password) + ret = verify_worker_version(remote, worker_info["username"], password, worker_lock) if ret is False: current_state["alive"] = False if not ret: @@ -1464,7 +1466,12 @@ def worker(): # Check the worker version and upgrade if necessary try: - if verify_worker_version(remote, options.username, options.password) is False: + if ( + verify_worker_version( + remote, options.username, options.password, worker_lock + ) + is False + ): return 1 except Exception as e: print("Exception verifying worker version:\n", e, sep="", file=sys.stderr) @@ -1562,6 +1569,7 @@ def worker(): current_state, clear_binaries, options.global_cache, + worker_lock, ) if not current_state["alive"]: # the user may have pressed Ctrl-C... break