Skip to content

Commit

Permalink
Don't send live data until nothing to catchup
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Sep 14, 2018
1 parent bbcc543 commit 7f2fa93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '18.9.0'
_release = '1633'
_commit = 'a47726b'
_release = '1634'
_commit = 'bbcc543'
12 changes: 5 additions & 7 deletions src/pywws/service/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,16 @@ def upload(self, live_data=None, test_mode=False, options=()):
if self.queue.full():
return
if test_mode:
idx = self.context.calib_data.before(datetime.max)
start = self.context.calib_data.before(datetime.max)
else:
idx = self.context.calib_data.after(self.last_update + self.interval)
while idx:
data = self.context.calib_data[idx]
start = self.last_update + self.interval
for data in self.context.calib_data[start:]:
timestamp = data['idx']
idx = self.context.calib_data.after(timestamp + SECOND)
if test_mode:
timestamp = None
if self.queue_data(timestamp, data):
break
if live_data and not idx:
return
if live_data:
self.queue_data(live_data['idx'], live_data)


Expand Down

0 comments on commit 7f2fa93

Please sign in to comment.