Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin/datastore-service
diff options
context:
space:
mode:
Diffstat (limited to 'bin/datastore-service')
-rwxr-xr-xbin/datastore-service25
1 files changed, 18 insertions, 7 deletions
diff --git a/bin/datastore-service b/bin/datastore-service
index 8f07458..140f494 100755
--- a/bin/datastore-service
+++ b/bin/datastore-service
@@ -46,13 +46,12 @@ logging.info("Starting Datastore %s" % (repo_dir))
mainloop = gobject.MainLoop()
def handle_disconnect():
- global mainloop
- mainloop.quit()
- logging.debug("Datastore disconnected from the bus.")
+ global connected
+ connected = False
def handle_shutdown(signum, frame):
- global mainloop
- mainloop.quit()
+ global connected
+ connected = False
raise SystemExit("Shutting down on signal %s" % signum)
bus.set_exit_on_disconnect(False)
@@ -64,17 +63,29 @@ signal.signal(signal.SIGHUP, handle_shutdown)
signal.signal(signal.SIGTERM, handle_shutdown)
def main():
+ # XXX: The context/sleep loop is a work around for what seems
+ # to be the mainloop blocking in such a way that the indexer
+ # thread doesn't run until new dbus messages come in...
+ # I intend to track this down post trial-2
+ # really awful
+ import time
+ context = mainloop.get_context()
+
if '-m' in sys.argv:
# mount automatically for local testing
ds.mount(repo_dir)
ds.complete_indexing()
try:
- mainloop.run()
+ while connected:
+ context.iteration(False)
+ time.sleep(0.0025)
+
except KeyboardInterrupt:
logging.info("DataStore shutdown by user")
except:
- logging.error("Datastore shutdown with error", exc_info=sys.exc_info())
+ logging.debug("Datastore shutdown with error",
+ exc_info=sys.exc_info())
main()