aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vk/utils/tracking/status_tracker.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-06-18 02:22:36 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-06-18 02:22:36 +0300
commitf39f18c94060642859900bdb04cb4df2164bc8b4 (patch)
treeeb29d7577e95c32a0894c134214b86db44c3b074 /vk/utils/tracking/status_tracker.py
parentrefactoring (diff)
downloadvk-scripts-f39f18c94060642859900bdb04cb4df2164bc8b4.tar.gz
vk-scripts-f39f18c94060642859900bdb04cb4df2164bc8b4.zip
put format-specific db writers/readers together
Diffstat (limited to '')
-rw-r--r--vk/utils/tracking/status_tracker.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/vk/utils/tracking/status_tracker.py b/vk/utils/tracking/status_tracker.py
index f208884..3d1f032 100644
--- a/vk/utils/tracking/status_tracker.py
+++ b/vk/utils/tracking/status_tracker.py
@@ -21,6 +21,11 @@ class StatusTracker:
def _wait_after_connection_error(self):
time.sleep(self._timeout)
+ def add_database_writer(self, writer):
+ self.add_initial_status_handler(lambda user: writer.on_initial_status(user))
+ self.add_status_update_handler(lambda user: writer.on_status_update(user))
+ self.add_connection_error_handler(lambda e: writer.on_connection_error(e))
+
def add_initial_status_handler(self, fn):
self._assert_is_callback(fn)
self._on_initial_status.append(fn)