Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
9ad448c1
Commit
9ad448c1
authored
6 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Correctly handle all command line options
parent
f5d57d48
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/app/_base.py
+12
-6
12 additions, 6 deletions
synapse/app/_base.py
synapse/app/homeserver.py
+7
-9
7 additions, 9 deletions
synapse/app/homeserver.py
synapse/config/workers.py
+23
-1
23 additions, 1 deletion
synapse/config/workers.py
with
42 additions
and
16 deletions
synapse/app/_base.py
+
12
−
6
View file @
9ad448c1
...
@@ -63,12 +63,13 @@ def start_worker_reactor(appname, config):
...
@@ -63,12 +63,13 @@ def start_worker_reactor(appname, config):
start_reactor
(
start_reactor
(
appname
,
appname
,
config
.
soft_file_limit
,
soft_file_limit
=
config
.
soft_file_limit
,
config
.
gc_thresholds
,
gc_thresholds
=
config
.
gc_thresholds
,
config
.
worker_pid_file
,
pid_file
=
config
.
worker_pid_file
,
config
.
worker_daemonize
,
daemonize
=
config
.
worker_daemonize
,
config
.
worker_cpu_affinity
,
cpu_affinity
=
config
.
worker_cpu_affinity
,
logger
,
print_pidfile
=
config
.
print_pidfile
,
logger
=
logger
,
)
)
...
@@ -79,6 +80,7 @@ def start_reactor(
...
@@ -79,6 +80,7 @@ def start_reactor(
pid_file
,
pid_file
,
daemonize
,
daemonize
,
cpu_affinity
,
cpu_affinity
,
print_pidfile
,
logger
,
logger
,
):
):
"""
Run the reactor in the main process
"""
Run the reactor in the main process
...
@@ -93,6 +95,7 @@ def start_reactor(
...
@@ -93,6 +95,7 @@ def start_reactor(
pid_file (str): name of pid file to write to if daemonize is True
pid_file (str): name of pid file to write to if daemonize is True
daemonize (bool): true to run the reactor in a background process
daemonize (bool): true to run the reactor in a background process
cpu_affinity (int|None): cpu affinity mask
cpu_affinity (int|None): cpu affinity mask
print_pidfile (bool): whether to print the pid file, if daemonize is True
logger (logging.Logger): logger instance to pass to Daemonize
logger (logging.Logger): logger instance to pass to Daemonize
"""
"""
...
@@ -124,6 +127,9 @@ def start_reactor(
...
@@ -124,6 +127,9 @@ def start_reactor(
reactor
.
run
()
reactor
.
run
()
if
daemonize
:
if
daemonize
:
if
print_pidfile
:
print
(
pid_file
)
daemon
=
Daemonize
(
daemon
=
Daemonize
(
app
=
appname
,
app
=
appname
,
pid
=
pid_file
,
pid
=
pid_file
,
...
...
This diff is collapsed.
Click to expand it.
synapse/app/homeserver.py
+
7
−
9
View file @
9ad448c1
...
@@ -636,17 +636,15 @@ def run(hs):
...
@@ -636,17 +636,15 @@ def run(hs):
# be quite busy the first few minutes
# be quite busy the first few minutes
clock
.
call_later
(
5
*
60
,
start_phone_stats_home
)
clock
.
call_later
(
5
*
60
,
start_phone_stats_home
)
if
hs
.
config
.
daemonize
and
hs
.
config
.
print_pidfile
:
print
(
hs
.
config
.
pid_file
)
_base
.
start_reactor
(
_base
.
start_reactor
(
"
synapse-homeserver
"
,
"
synapse-homeserver
"
,
hs
.
config
.
soft_file_limit
,
soft_file_limit
=
hs
.
config
.
soft_file_limit
,
hs
.
config
.
gc_thresholds
,
gc_thresholds
=
hs
.
config
.
gc_thresholds
,
hs
.
config
.
pid_file
,
pid_file
=
hs
.
config
.
pid_file
,
hs
.
config
.
daemonize
,
daemonize
=
hs
.
config
.
daemonize
,
hs
.
config
.
cpu_affinity
,
cpu_affinity
=
hs
.
config
.
cpu_affinity
,
logger
,
print_pidfile
=
hs
.
config
.
print_pidfile
,
logger
=
logger
,
)
)
...
...
This diff is collapsed.
Click to expand it.
synapse/config/workers.py
+
23
−
1
View file @
9ad448c1
...
@@ -28,7 +28,7 @@ class WorkerConfig(Config):
...
@@ -28,7 +28,7 @@ class WorkerConfig(Config):
if
self
.
worker_app
==
"
synapse.app.homeserver
"
:
if
self
.
worker_app
==
"
synapse.app.homeserver
"
:
self
.
worker_app
=
None
self
.
worker_app
=
None
self
.
worker_listeners
=
config
.
get
(
"
worker_listeners
"
)
self
.
worker_listeners
=
config
.
get
(
"
worker_listeners
"
,
[]
)
self
.
worker_daemonize
=
config
.
get
(
"
worker_daemonize
"
)
self
.
worker_daemonize
=
config
.
get
(
"
worker_daemonize
"
)
self
.
worker_pid_file
=
config
.
get
(
"
worker_pid_file
"
)
self
.
worker_pid_file
=
config
.
get
(
"
worker_pid_file
"
)
self
.
worker_log_file
=
config
.
get
(
"
worker_log_file
"
)
self
.
worker_log_file
=
config
.
get
(
"
worker_log_file
"
)
...
@@ -48,6 +48,17 @@ class WorkerConfig(Config):
...
@@ -48,6 +48,17 @@ class WorkerConfig(Config):
self
.
worker_main_http_uri
=
config
.
get
(
"
worker_main_http_uri
"
,
None
)
self
.
worker_main_http_uri
=
config
.
get
(
"
worker_main_http_uri
"
,
None
)
self
.
worker_cpu_affinity
=
config
.
get
(
"
worker_cpu_affinity
"
)
self
.
worker_cpu_affinity
=
config
.
get
(
"
worker_cpu_affinity
"
)
# This option is really only here to support `--manhole` command line
# argument.
manhole
=
config
.
get
(
"
worker_manhole
"
)
if
manhole
:
self
.
worker_listeners
.
append
({
"
port
"
:
manhole
,
"
bind_addresses
"
:
[
"
127.0.0.1
"
],
"
type
"
:
"
manhole
"
,
"
tls
"
:
False
,
})
if
self
.
worker_listeners
:
if
self
.
worker_listeners
:
for
listener
in
self
.
worker_listeners
:
for
listener
in
self
.
worker_listeners
:
bind_address
=
listener
.
pop
(
"
bind_address
"
,
None
)
bind_address
=
listener
.
pop
(
"
bind_address
"
,
None
)
...
@@ -59,5 +70,16 @@ class WorkerConfig(Config):
...
@@ -59,5 +70,16 @@ class WorkerConfig(Config):
bind_addresses
.
append
(
''
)
bind_addresses
.
append
(
''
)
def
read_arguments
(
self
,
args
):
def
read_arguments
(
self
,
args
):
# We support a bunch of command line arguments that override options in
# the config. A lot of these options have a worker_* prefix when running
# on workers so we also have to override them when command line options
# are specified.
if
args
.
daemonize
is
not
None
:
if
args
.
daemonize
is
not
None
:
self
.
worker_daemonize
=
args
.
daemonize
self
.
worker_daemonize
=
args
.
daemonize
if
args
.
log_config
is
not
None
:
self
.
worker_log_config
=
args
.
log_config
if
args
.
log_file
is
not
None
:
self
.
worker_log_file
=
args
.
log_file
if
args
.
manhole
is
not
None
:
self
.
worker_manhole
=
args
.
worker_manhole
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment