Add Watcher.setup()
method for datasync
This commit is contained in:
parent
9c487a7a33
commit
9d72f723e8
|
@ -92,6 +92,9 @@ def watch_for_changes(config, watcher):
|
|||
"""
|
||||
from rattail.db import Session, model
|
||||
|
||||
# Let watcher do any setup it needs.
|
||||
watcher.setup()
|
||||
|
||||
# The 'last run' value is maintained as a naive UTC datetime.
|
||||
timefmt = '%Y-%m-%d %H:%M:%S'
|
||||
lastrun_setting = 'rattail.datasync.{0}.watcher.lastrun'.format(watcher.key)
|
||||
|
|
|
@ -37,6 +37,11 @@ class DataSyncWatcher(object):
|
|||
self.key = key
|
||||
self.delay = 1 # seconds
|
||||
|
||||
def setup(self):
|
||||
"""
|
||||
This method is called when the watcher thread is first started.
|
||||
"""
|
||||
|
||||
def get_changes(self, lastrun):
|
||||
"""
|
||||
This must be implemented by the subclass. It should check the source
|
||||
|
|
Loading…
Reference in a new issue