Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix synctl and duplicate worker spawning #8798

Merged
merged 3 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8798.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug where synctl could spawn duplicate copies of a worker. Contributed by Waylon Cude.
7 changes: 7 additions & 0 deletions synctl
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@ def main():
for worker in workers:
env = os.environ.copy()

# Skip starting a worker if its already running
if os.path.exists(worker.pidfile) and pid_running(
int(open(worker.pidfile).read())
):
print(worker.app + " already running")
continue

if worker.cache_factor:
os.environ["SYNAPSE_CACHE_FACTOR"] = str(worker.cache_factor)

Expand Down