Skip to content

Commit

Permalink
earthquakemap: Increase cache interval (#2787)
Browse files Browse the repository at this point in the history
Cache earthquake data for 15 minutes instead of 1 minute.
  • Loading branch information
rohansingh authored Oct 9, 2024
1 parent 5848877 commit 64fb560
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/earthquakemap/earthquake_map.star
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DISPLAY_Y_SIZE = 32

HTTP_STATUS_OK = 200

API_CACHE_TTL = 60 # seconds
API_CACHE_TTL = 60 * 15 # seconds

EARTHQUAKES_LAST_30_DAYS_URL = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson"

Expand Down Expand Up @@ -122,7 +122,7 @@ def get_usgs_data(magnitude_filter = None, time_filter = None, type_filter = Non
time_filter = duration_calc(30, "days")
time_filter = time.parse_duration("{}s".format(time_filter))

api_reply = http.get(EARTHQUAKES_LAST_30_DAYS_URL, ttl_seconds = 60)
api_reply = http.get(EARTHQUAKES_LAST_30_DAYS_URL, ttl_seconds = API_CACHE_TTL)
if api_reply.status_code == HTTP_STATUS_OK:
geojson_raw = api_reply.body()
else:
Expand Down

0 comments on commit 64fb560

Please sign in to comment.