mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
testing: Move _worker_id incrementer block to the top.
Incrementing the _worker_id should be the first step for the process. It gives better structure to the code.
This commit is contained in:
@@ -295,6 +295,15 @@ def init_worker(counter):
|
||||
individual processes which are also called workers.
|
||||
"""
|
||||
global _worker_id
|
||||
|
||||
with counter.get_lock():
|
||||
counter.value += 1
|
||||
_worker_id = counter.value
|
||||
|
||||
"""
|
||||
You can now use _worker_id.
|
||||
"""
|
||||
|
||||
test_classes.API_KEYS = {}
|
||||
|
||||
# Clear the cache
|
||||
@@ -305,10 +314,6 @@ def init_worker(counter):
|
||||
# Close all connections
|
||||
connections.close_all()
|
||||
|
||||
with counter.get_lock():
|
||||
counter.value += 1
|
||||
_worker_id = counter.value
|
||||
|
||||
destroy_test_databases(_worker_id)
|
||||
create_test_databases(_worker_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user