Updated for GmCapsule v0.5 API changes

Check if background work can be started.
This commit is contained in:
Jaakko Keränen 2023-06-17 10:57:16 +03:00
parent 309f0ecfe3
commit 0df59c3ee9
No known key found for this signature in database
GPG Key ID: BACCFCFB98DB2EDC
1 changed files with 10 additions and 9 deletions

View File

@ -619,8 +619,8 @@ when the administrator assigns at least one moderator to it.
return make_feed_page(session)
def init(capsule):
cfg = capsule.config()
def init(context):
cfg = context.config()
try:
mod_cfg = cfg.section('bubble')
@ -636,15 +636,16 @@ def init(capsule):
port = cfg.section('server').getint('port', 1965)
for hostname in hostnames:
responder = Bubble(capsule, hostname, port, path, mod_cfg)
capsule.add(path + '*', responder, hostname, protocol='gemini')
capsule.add(path + '*', responder, hostname, protocol='titan')
responder = Bubble(context, hostname, port, path, mod_cfg)
context.add(path + '*', responder, hostname, protocol='gemini')
context.add(path + '*', responder, hostname, protocol='titan')
emailer = Emailer(capsule, hostnames[0], port, mod_cfg)
emailer.start()
if context.is_background_work_allowed():
emailer = Emailer(context, hostnames[0], port, mod_cfg)
emailer.start()
fetcher = RepoFetcher(capsule, mod_cfg)
fetcher.start()
fetcher = RepoFetcher(context, mod_cfg)
fetcher.start()
except KeyError:
pass