mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Disk-based caching for spots so they survive a software restart
This commit is contained in:
@@ -16,10 +16,10 @@ from core.utils import serialize_everything
|
||||
class WebServer:
|
||||
|
||||
# Constructor
|
||||
def __init__(self, spot_list, status_data, port):
|
||||
def __init__(self, spots, status_data, port):
|
||||
self.last_page_access_time = None
|
||||
self.last_api_access_time = None
|
||||
self.spot_list = spot_list
|
||||
self.spots = spots
|
||||
self.status_data = status_data
|
||||
self.port = port
|
||||
self.thread = Thread(target=self.run)
|
||||
@@ -90,7 +90,11 @@ class WebServer:
|
||||
# value or a comma-separated list.
|
||||
# We can provide a "limit" number as well. Spots are always returned newest-first; "limit" limits to only the
|
||||
# most recent X spots.
|
||||
spots = sorted(self.spot_list, key=lambda spot: spot.time, reverse=True)
|
||||
spot_guids = list(self.spots.iterkeys())
|
||||
spots = []
|
||||
for k in spot_guids:
|
||||
spots.append(self.spots.get(k))
|
||||
spots = sorted(spots, key=lambda spot: spot.time, reverse=True)
|
||||
for k in query.keys():
|
||||
match k:
|
||||
case "since":
|
||||
|
||||
Reference in New Issue
Block a user