nixpkgs/pkgs/servers/matrix-synapse/0002-Expose-generic-worker-as-binary-under-NixOS.patch

44 lines
1.2 KiB
Diff

From 3089758015c64cc1e6788793c4fe40a0e1783457 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Tue, 5 Oct 2021 22:33:12 +0200
Subject: [PATCH 2/2] Expose generic worker as binary under NixOS
---
setup.py | 3 ++-
synapse/app/generic_worker.py | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 27f1d842c..6383aed6f 100755
--- a/setup.py
+++ b/setup.py
@@ -135,7 +135,8 @@ setup(
python_requires="~=3.6",
entry_points={
'console_scripts': [
- 'homeserver = synapse.app.homeserver:main'
+ 'homeserver = synapse.app.homeserver:main',
+ 'worker = synapse.app.generic_worker:main'
]
},
classifiers=[
diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py
index 3b7131af8..c77a6a95c 100644
--- a/synapse/app/generic_worker.py
+++ b/synapse/app/generic_worker.py
@@ -491,6 +491,10 @@ def start(config_options):
_base.start_worker_reactor("synapse-generic-worker", config)
-if __name__ == "__main__":
+def main():
with LoggingContext("main"):
start(sys.argv[1:])
+
+
+if __name__ == "__main__":
+ main()
--
2.31.1