Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
6df5a6a8
Commit
6df5a6a8
authored
8 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Optionally daemonize the pusher
parent
3306cf45
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/app/pusher.py
+31
-4
31 additions, 4 deletions
synapse/app/pusher.py
with
31 additions
and
4 deletions
synapse/app/pusher.py
+
31
−
4
View file @
6df5a6a8
...
...
@@ -37,6 +37,8 @@ from synapse.util.versionstring import get_version_string
from
twisted.internet
import
reactor
,
defer
from
twisted.web.resource
import
Resource
from
daemonize
import
Daemonize
import
sys
import
logging
...
...
@@ -54,13 +56,19 @@ class SlaveConfig(DatabaseConfig):
self
.
start_pushers
=
True
self
.
listeners
=
config
[
"
listeners
"
]
self
.
soft_file_limit
=
config
.
get
(
"
soft_file_limit
"
)
self
.
daemonize
=
config
.
get
(
"
daemonize
"
)
self
.
pid_file
=
self
.
abspath
(
config
.
get
(
"
pid_file
"
))
def
default_config
(
self
,
**
kwargs
):
def
default_config
(
self
,
server_name
,
**
kwargs
):
pid_file
=
self
.
abspath
(
"
pusher.pid
"
)
return
"""
\
## Slave ##
# Slave configuration
# The replication listener on the synapse to talk to.
#replication_url: https://localhost:{replication_port}/_synapse/replication
server_name:
"
%(server_name)s
"
listeners: []
# Enable a ssh manhole listener on the pusher.
# - type: manhole
...
...
@@ -75,7 +83,12 @@ class SlaveConfig(DatabaseConfig):
# compress: False
report_stats: False
"""
daemonize: False
pid_file: %(pid_file)s
"""
%
locals
()
class
PusherSlaveConfig
(
SlaveConfig
,
LoggingConfig
):
...
...
@@ -248,6 +261,9 @@ def setup(config_options):
sys
.
stderr
.
write
(
"
\n
"
+
e
.
message
+
"
\n
"
)
sys
.
exit
(
1
)
if
not
config
:
sys
.
exit
(
0
)
config
.
setup_logging
()
database_engine
=
create_engine
(
config
.
database_config
)
...
...
@@ -278,4 +294,15 @@ def setup(config_options):
if
__name__
==
'
__main__
'
:
with
LoggingContext
(
"
main
"
):
ps
=
setup
(
sys
.
argv
[
1
:])
reactor
.
run
()
if
ps
.
config
.
daemonize
:
daemon
=
Daemonize
(
app
=
"
synapse-pusher
"
,
pid
=
ps
.
config
.
pid_file
,
action
=
reactor
.
run
,
auto_close_fds
=
False
,
verbose
=
True
,
logger
=
logger
,
)
else
:
reactor
.
run
()
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