nncli

NextCloud Notes Command Line Interface
git clone git://git.danielmoch.com/nncli.git
Log | Files | Refs | LICENSE

commit d45d66ce377c881bd3f11968c605275c82df9f23
parent 5d8e25a658b7e7b398f0821d7ae5273c823b4e26
Author: Eric Davis <edavis@insanum.com>
Date:   Wed,  2 Jul 2014 19:03:22 -0700

added a background save_worker thread

Diffstat:
Msncli.py | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sncli.py b/sncli.py @@ -47,10 +47,16 @@ def __init__(self, do_sync): self.sync_notes_alarm = None self.sync_notes_lock = threading.Lock() + self.thread_save = threading.Thread(target=self.ndb.save_worker) + self.thread_save.setDaemon(True) + self.ndb.add_observer('synced:note', self.observer_notes_db_synced_note) self.ndb.add_observer('change:note-status', self.observer_notes_db_change_note_status) self.ndb.add_observer('progress:sync_full', self.observer_notes_db_sync_full) + def start_threads(self): + self.thread_save.start() + def sync_full_threaded(self): thread.start_new_thread(self.ndb.sync_full, ()) @@ -83,7 +89,6 @@ def sync_notes_schedule(self): self.sncli_loop.remove_alarm(self.sync_notes_alarm) self.sync_notes_alarm = None - self.ndb.save_threaded() self.sync_notes_alarm = \ self.sncli_loop.set_alarm_at(time.time() + 4, self.sync_notes_timeout, @@ -408,6 +413,8 @@ def init_view(self, loop, arg): 'sync_func' : self.sync_notes_schedule })) + self.start_threads() + if self.do_sync: # start full sync after initial view is up #self.sync_full_threaded()