Commit bf0ad382 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: speed up Base_reindexAndSenseAlarm execution

parent 7c4188b1
...@@ -14,10 +14,11 @@ if alarm_tool.isSubscribed() and len(alarm_id_list): ...@@ -14,10 +14,11 @@ if alarm_tool.isSubscribed() and len(alarm_id_list):
if alarm.isEnabled(): if alarm.isEnabled():
# do nothing if the alarm is not enabled # do nothing if the alarm is not enabled
if alarm.isActive(): if alarm.isActive() or (tag is not None):
# Wait for the previous alarm run to be finished # Wait for the previous alarm run to be finished
context.activate(after_path=alarm.getPath(), after_tag=tag).Base_reindexAndSenseAlarm([alarm_id], must_reindex_context=False)
else:
# wait for the context to be reindexed before activating the alarm # wait for the context to be reindexed before activating the alarm
# ROMAIN: SQLQueue is used, because I'm not sure if SQLDict drop activities with different after_tag # ROMAIN: SQLQueue is used, because I'm not sure if SQLDict drop activities with different after_tag
alarm.activate(queue='SQLQueue', after_tag=tag).activeSense() # ROMAIN: getId is used, because most alarm script ends with an getId activity
alarm.activate(queue='SQLQueue', after_path_and_method_id=(alarm.getPath(), 'getId'), after_tag=tag).activeSense()
else:
alarm.activeSense()
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