Commit 42c87512 authored by nextime's avatar nextime

Little fix in database coherence

parent 72ab1e97
...@@ -1667,13 +1667,8 @@ class domotikaService(service.Service): ...@@ -1667,13 +1667,8 @@ class domotikaService(service.Service):
and converWday(loctime.tm_wday) in timedict["dows"] and converWday(loctime.tm_wday) in timedict["dows"]
and loctime.tm_hour in timedict["hours"] and loctime.tm_hour in timedict["hours"]
and loctime.tm_min in timedict["minutes"]): and loctime.tm_min in timedict["minutes"]):
# Do nothing mean "ok, maybe it's to be executed
if (time.time()-float(ract.lastrun)) < float(ract.min_time): pass
continue
ract.lastrun=time.time()
ract.save()
else: else:
continue continue
...@@ -1703,7 +1698,13 @@ class domotikaService(service.Service): ...@@ -1703,7 +1698,13 @@ class domotikaService(service.Service):
else: else:
continue continue
if (time.time()-float(ract.lastrun)) < float(ract.min_time):
continue
# if we are here, the actions is to be executed! # if we are here, the actions is to be executed!
ract.lastrun=time.time()
ract.save()
if genutils.isTrue(ract.ikapacket): if genutils.isTrue(ract.ikapacket):
self.sendCommand(ract.ikap_dst, act=ract.ikap_act, ctx=ract.ikap_ctx, msgtype=ract.ikap_msgtype, self.sendCommand(ract.ikap_dst, act=ract.ikap_act, ctx=ract.ikap_ctx, msgtype=ract.ikap_msgtype,
arg=ract.ikap_arg, src=ract.ikap_src, ipdst=str(ract.ipdest)) arg=ract.ikap_arg, src=ract.ikap_src, ipdst=str(ract.ipdest))
...@@ -1712,6 +1713,8 @@ class domotikaService(service.Service): ...@@ -1712,6 +1713,8 @@ class domotikaService(service.Service):
if genutils.isTrue(ract.launch_sequence) and ract.launch_sequence_name != None: if genutils.isTrue(ract.launch_sequence) and ract.launch_sequence_name != None:
reactor.callLater(ract.retard, self.launchSequence, ract.launch_sequence_name, 'statuses') reactor.callLater(ract.retard, self.launchSequence, ract.launch_sequence_name, 'statuses')
def launchSequence(self, name, sequencecaller='unknown'): def launchSequence(self, name, sequencecaller='unknown'):
return dmdb.getSequence(name).addCallback(self.manageSequence, sequencecaller) return dmdb.getSequence(name).addCallback(self.manageSequence, sequencecaller)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment