Skip to content

Commit

Permalink
fix update issue in health submodule #69
Browse files Browse the repository at this point in the history
  • Loading branch information
roe-dl committed Aug 4, 2024
1 parent 22a10a6 commit 5a8c316
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bin/user/weatherserviceshealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def __init__(self, name, conf_dict, archive_interval):
self.area = conf_dict.get('area')
self.target_path = conf_dict.get('path','.')
self.filename = '%s-%s' % (self.model,conf_dict.get('file',self.area))
self.data = dict()
self.data = []
self.tab = (dict(),dict())
loginf("thread '%s': area '%s', URL '%s'" % (self.name,self.area,self.url))
self.last_update = 0
Expand Down Expand Up @@ -721,18 +721,25 @@ def getRecord(self):
except Exception as e:
if self.log_failure:
logerr("thread '%s': write HTML %s - %s" % (self.name,e.__class__.__name__,e))
data.sort()
try:
self.lock.acquire()
self.last_update = last_update
self.next_update = next_update
self.area_name = area_name
if self.data:
self.data = [self.data[-1]] + data
x = None
for i in self.data:
if i[1]==data[0][0]:
x = i
break
if x:
self.data = [x] + data
else:
self.data = data
self.tab = tabtimespans
finally:
self.lock.release()
#loginf("getRecord %s" % ','.join(['(%s,%s)' % (i[0],i[1]) for i in self.data]))

def waiting_time(self):
now = time.time()
Expand Down

0 comments on commit 5a8c316

Please sign in to comment.