feature/filter-failure-notification
dgtlmoon 2 years ago
parent 2584af19d2
commit c2deb18945

@ -391,7 +391,7 @@ class globalSettingsApplicationForm(commonSettingsForm):
filter_failure_notification_threshold_attempts = IntegerField('Number of times the filter can be missing before sending a notification',
render_kw={"style": "width: 5em;"},
validators=[validators.NumberRange(min=10,
validators=[validators.NumberRange(min=0,
message="Should contain zero or more attempts")])

@ -38,7 +38,10 @@
</div>
<div class="pure-control-group">
{{ render_field(form.application.form.filter_failure_notification_threshold_attempts, class="filter_failure_notification_threshold_attempts") }}
<span class="pure-form-message-inline">After this many consecutive times that the CSS/xPath filter is missing, send a notification</span>
<span class="pure-form-message-inline">After this many consecutive times that the CSS/xPath filter is missing, send a notification
<br/>
Set to <strong>0</strong> to disable
</span>
</div>
<div class="pure-control-group">
{% if not hide_remove_pass %}

@ -91,10 +91,9 @@ class update_worker(threading.Thread):
c += 1
# Send notification if we reached the threshold?
threshold = self.datastore.data['settings']['application'].get('filter_failure_notification_threshold_attempts',
False)
threshold = self.datastore.data['settings']['application'].get('filter_failure_notification_threshold_attempts', 0)
print("Filter for {} not found, consecutive_filter_failures: {}".format(uuid, c))
if threshold and c >= threshold:
if threshold >0 and c >= threshold:
self.send_filter_failure_notification(uuid)
c = 0

Loading…
Cancel
Save