Esempio n. 1
0
 def unsubscribe(self, uuid: str) -> None:
     """
     Remove subscriber with the provided uuid
     """
     with atomic(self.conn) as conn:
         sub = self.subscribers[uuid]
         remove_trigger(conn, sub.trigger_id)
         sub.schedule_stop()
         sub.join()
         del self.subscribers[uuid]
Esempio n. 2
0
 def unsubscribe_all(self):
     """
     Remove all subscribers
     """
     sql = "select * from sqlite_master where type = 'trigger';"
     triggers = atomic_transaction(self.conn, sql).fetchall()
     with atomic(self.conn) as conn:
         for trigger in triggers:
             remove_trigger(conn, trigger['name'])
         for sub in self.subscribers.values():
             sub.schedule_stop()
             sub.join()
         self.subscribers.clear()