summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorPixpoa pairing <pixpoapairing@pixelated-project.org>2015-01-23 14:29:48 -0200
committerPixpoa pairing <pixpoapairing@pixelated-project.org>2015-01-23 14:30:27 -0200
commitcb65ba82f11c552d6f19c260e2426f25ee9b0f6c (patch)
tree1a46e749d371f0477329959c19e0b8550aff8c63 /service/pixelated
parent562a35d2bf9fd0626f02f60a300a25dc9d9b055a (diff)
When closing the app now it wont get stuck, but it will finish the last scheduled soledad sync call before it stops
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/config/app_factory.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/service/pixelated/config/app_factory.py b/service/pixelated/config/app_factory.py
index 86816b87..cd9f363f 100644
--- a/service/pixelated/config/app_factory.py
+++ b/service/pixelated/config/app_factory.py
@@ -84,6 +84,13 @@ def look_for_user_key_and_create_if_cant_find(leap_session):
return wrapper
+def stop_incoming_mail_fetcher(reactor_stop_function, leap_session):
+ def wrapper():
+ leap_session.stop_background_jobs()
+ reactor_stop_function()
+ return wrapper
+
+
def init_app(app, leap_home):
leap_session = init_leap_session(app, leap_home)
soledad_querier = SoledadQuerier(soledad=leap_session.account._soledad)
@@ -109,6 +116,8 @@ def init_app(app, leap_home):
register(signal=proto.SOLEDAD_DONE_DATA_SYNC, uid=CREATE_KEYS_IF_KEYS_DONT_EXISTS_CALLBACK,
callback=look_for_user_key_and_create_if_cant_find(leap_session))
+ reactor.stop = stop_incoming_mail_fetcher(reactor.stop, leap_session)
+
def create_app(app, args):
app.resource = RootResource()