Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop dependency on sdnotify #5871

Merged
merged 4 commits into from Aug 17, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

black

  • Loading branch information...
richvdh committed Aug 16, 2019
commit 3d73249b191687babe6bf81a60e80fc550b4669d
@@ -308,14 +308,11 @@ def setup_sdnotify(hs):
# Tell systemd our state, if we're using it. This will silently fail if
# we're not using systemd.
hs.get_reactor().addSystemEventTrigger(
"after",
"startup",
sdnotify,
b"READY=1\nMAINPID=%i" % (os.getpid(), ),
"after", "startup", sdnotify, b"READY=1\nMAINPID=%i" % (os.getpid(),)
)

hs.get_reactor().addSystemEventTrigger(
"before", "shutdown", sdnotify, b"STOPPING=1",
"before", "shutdown", sdnotify, b"STOPPING=1"
)


@@ -414,7 +411,7 @@ def resolutionComplete(self):
self._receiver.resolutionComplete()


sdnotify_sockaddr = os.getenv('NOTIFY_SOCKET')
sdnotify_sockaddr = os.getenv("NOTIFY_SOCKET")


def sdnotify(state):
@@ -433,8 +430,8 @@ def sdnotify(state):
if not sdnotify_sockaddr:
return
addr = sdnotify_sockaddr
if addr[0] == '@':
addr = '\0' + addr[1:]
if addr[0] == "@":
addr = "\0" + addr[1:]

try:
with socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) as sock:
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.