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 17:43:12 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-10-31 17:43:12 (GMT)
commitf0753fadc877dc8408db6c7d5d54d9ffbc171b75 (patch)
treeebfc7cf04d08b7f9604da41da74ecb63c32c33d2 /bin
parent6bb99669eb0606c56ee195473006e219cedb9e81 (diff)
Revert "#4083: Remove the active loop and check usb sticks on idle."
No need to move usb stick checking to the idle event. We can keep using a background thread if we tell glib and dbus to initialize threads. This reverts commit 8f8bbe73fdc61ce3c1716bfc57a21eef7cb2d7e6. Conflicts: NEWS Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Diffstat (limited to 'bin')
-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()