mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-12-16 09:03:39 +00:00
Improve expired spot handling and efficiency of handling expired spots during web requests.
This commit is contained in:
@@ -29,12 +29,15 @@ class CleanupTimer:
|
||||
# Perform cleanup and reschedule next timer
|
||||
def cleanup(self):
|
||||
try:
|
||||
# Perform cleanup
|
||||
# Perform cleanup via letting the data expire
|
||||
self.spots.expire()
|
||||
self.alerts.expire()
|
||||
|
||||
# Alerts can persist in the system for a while, so we want to explicitly clean up any alerts that have
|
||||
# expired
|
||||
# Explicitly clean up any spots and alerts that have expired
|
||||
for id in list(self.spots.iterkeys()):
|
||||
spot = self.spots[id]
|
||||
if spot.expired():
|
||||
self.spots.delete(id)
|
||||
for id in list(self.alerts.iterkeys()):
|
||||
alert = self.alerts[id]
|
||||
if alert.expired():
|
||||
|
||||
Reference in New Issue
Block a user