Skip to content

Commit

Permalink
Merge pull request Yelp#2950 from singyiu/issue-2518
Browse files Browse the repository at this point in the history
fix issue 2518, where false positive may be triggered sometimes
  • Loading branch information
Qmando authored Sep 1, 2020
2 parents 23c9e64 + cfad1cc commit 52a1251
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions elastalert/elastalert.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ def run_query(self, rule, start=None, end=None, scroll=False):

try:
if rule.get('scroll_id') and self.thread_data.num_hits < self.thread_data.total_hits and should_scrolling_continue(rule):
self.run_query(rule, start, end, scroll=True)
if not self.run_query(rule, start, end, scroll=True):
return False
except RuntimeError:
# It's possible to scroll far enough to hit max recursive depth
pass
Expand Down Expand Up @@ -894,7 +895,8 @@ def run_rule(self, rule, endtime, starttime=None):

if rule.get('aggregation_query_element'):
if endtime - tmp_endtime == segment_size:
self.run_query(rule, tmp_endtime, endtime)
if not self.run_query(rule, tmp_endtime, endtime):
return 0
self.thread_data.cumulative_hits += self.thread_data.num_hits
elif total_seconds(rule['original_starttime'] - tmp_endtime) == 0:
rule['starttime'] = rule['original_starttime']
Expand Down

0 comments on commit 52a1251

Please sign in to comment.