DuplicateMessages: Refactor isDuplicated() name to snake_case

This commit is contained in:
Athanasius 2021-11-04 16:24:43 +00:00
parent fb67f960be
commit 2d896ce37f
3 changed files with 3 additions and 3 deletions

View File

@ -229,7 +229,7 @@ class Monitor(Thread):
# Duplicates? # Duplicates?
if Settings.RELAY_DUPLICATE_MAX_MINUTES: if Settings.RELAY_DUPLICATE_MAX_MINUTES:
if duplicate_messages.isDuplicated(json): if duplicate_messages.is_duplicated(json):
schema_id = 'DUPLICATE MESSAGE' schema_id = 'DUPLICATE MESSAGE'
c = db.cursor() c = db.cursor()

View File

@ -156,7 +156,7 @@ class Relay(Thread):
# Handle duplicate message # Handle duplicate message
if Settings.RELAY_DUPLICATE_MAX_MINUTES: if Settings.RELAY_DUPLICATE_MAX_MINUTES:
if duplicate_messages.isDuplicated(json): if duplicate_messages.is_duplicated(json):
# We've already seen this message recently. Discard it. # We've already seen this message recently. Discard it.
stats_collector.tally("duplicate") stats_collector.tally("duplicate")
return return

View File

@ -36,7 +36,7 @@ class DuplicateMessages(Thread):
if self.caches[key] + timedelta(minutes=self.max_minutes) < max_time: if self.caches[key] + timedelta(minutes=self.max_minutes) < max_time:
del self.caches[key] del self.caches[key]
def isDuplicated(self, json): def is_duplicated(self, json):
with self.lock: with self.lock:
# Test messages are never duplicate, would be a pain to wait for another test :D # Test messages are never duplicate, would be a pain to wait for another test :D
if re.search('test', json['$schemaRef'], re.I): if re.search('test', json['$schemaRef'], re.I):