Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-10-31 10:30:36 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-10-31 10:30:36 (GMT)
commit8f8bbe73fdc61ce3c1716bfc57a21eef7cb2d7e6 (patch)
tree19212154e0cacabc3967418f77cf29fff14f7ceb /bin
parent9e2b0439160a2e24ec451fb97403b4b9b642535a (diff)
#4083: Remove the active loop and check usb sticks on idle.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/datastore-service25
1 files changed, 7 insertions, 18 deletions
diff --git a/bin/datastore-service b/bin/datastore-service
index 140f494..8f07458 100755
--- a/bin/datastore-service
+++ b/bin/datastore-service
@@ -46,12 +46,13 @@ logging.info("Starting Datastore %s" % (repo_dir))
mainloop = gobject.MainLoop()
def handle_disconnect():
- global connected
- connected = False
+ global mainloop
+ mainloop.quit()
+ logging.debug("Datastore disconnected from the bus.")
def handle_shutdown(signum, frame):
- global connected
- connected = False
+ global mainloop
+ mainloop.quit()
raise SystemExit("Shutting down on signal %s" % signum)
bus.set_exit_on_disconnect(False)
@@ -63,29 +64,17 @@ 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:
- while connected:
- context.iteration(False)
- time.sleep(0.0025)
-
+ mainloop.run()
except KeyboardInterrupt:
logging.info("DataStore shutdown by user")
except:
- logging.debug("Datastore shutdown with error",
- exc_info=sys.exc_info())
+ logging.error("Datastore shutdown with error", exc_info=sys.exc_info())
main()