mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 12:02:03 +02:00
stub for the daemon that notices when payments happen
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Wait for news about payments received for sesssions and
|
||||
# then mark the sessions to show that that payment was received.
|
||||
|
||||
# This daemon uses a different scheduling model from the
|
||||
# testchallenge daemon so ONLY ONE COPY OF THIS DAEMON SHOULD
|
||||
# BE RUN AT ONCE. Since this daemon takes a minimal, discrete
|
||||
# action in response to a pubsub message, there should never be
|
||||
# a significant backlog associated with this daemon.
|
||||
|
||||
import redis, signal, sys
|
||||
|
||||
r = redis.Redis()
|
||||
ps = r.pubsub()
|
||||
|
||||
debug = "debug" in sys.argv
|
||||
clean_shutdown = False
|
||||
|
||||
from daemon_common import signal_handler
|
||||
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
ps.subscribe(["payments", "exit"])
|
||||
for message in ps.listen():
|
||||
if message["type"] != "message":
|
||||
continue
|
||||
if message["channel"] == "payments":
|
||||
if debug: print message["data"]
|
||||
# TODO: Actually process the payment here :-)
|
||||
continue
|
||||
if message["channel"] == "exit":
|
||||
break
|
||||
if clean_shutdown:
|
||||
print "daemon exiting cleanly"
|
||||
break
|
||||
Reference in New Issue
Block a user