Skip to content

Commit e8bcc00

Browse files
committed
DBC22-6531: extended default timeout
1 parent 9e9707a commit e8bcc00

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

src/backend/apps/feed/client.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import httpx
77
import requests
88
from apps.event.serializers import CarsEventSerializer
9-
from apps.feed.constants import (
9+
from apps.feed.constants import ( # WEBCAM,
1010
CURRENT_WEATHER,
1111
CURRENT_WEATHER_STATIONS,
1212
DISTRICT_BOUNDARIES,
@@ -18,7 +18,6 @@
1818
REGIONAL_WEATHER,
1919
REGIONAL_WEATHER_AREAS,
2020
REST_STOP,
21-
# WEBCAM,
2221
WILDFIRE,
2322
)
2423
from apps.feed.serializers import (
@@ -29,19 +28,16 @@
2928
EventFeedSerializer,
3029
FerryAPISerializer,
3130
RestStopSerializer,
32-
WebcamAPISerializer,
33-
WebcamFeedSerializer,
3431
)
3532
from apps.shared.serializers import DistrictAPISerializer
3633
from apps.weather.models import CurrentWeather
34+
from apps.webcam.models import CameraSource
3735
from apps.wildfire.serializers import WildfireAreaSerializer, WildfirePointSerializer
3836
from django.conf import settings
3937
from django.contrib.gis.geos import Point
4038
from django.core.cache import cache
4139
from rest_framework.exceptions import ValidationError
4240
from rest_framework.response import Response
43-
from apps.weather.models import CurrentWeather
44-
from apps.webcam.models import CameraSource, Region, RegionHighway
4541

4642
# Maps the key for our client API's serializer fields to the matching pair of
4743
# the source API's DataSetName and DisplayName fields
@@ -151,7 +147,7 @@ def _get_response_data_or_raise(response):
151147
logger.error(f"An error occurred with status: {response.status_code}")
152148
response.raise_for_status()
153149

154-
def _process_get_request(self, endpoint, params, resource_type, timeout=5.0):
150+
def _process_get_request(self, endpoint, params, resource_type, timeout=15.0):
155151
logger.info(f"Requesting GET {endpoint} with params {params}")
156152
response = httpx.get(
157153
endpoint,
@@ -263,7 +259,6 @@ def get_list_feed(self, resource_type, resource_name, serializer_cls, params=Non
263259
new_serializer.is_valid(raise_exception=True)
264260
return new_serializer.validated_data
265261

266-
267262
def get_webcam_list(self):
268263
try:
269264
cameras = list(CameraSource.objects.using("mssql").all())
@@ -272,7 +267,7 @@ def get_webcam_list(self):
272267
except Exception as e:
273268
logging.exception(f"Failed to query camera from Webcam database: {e}")
274269
return []
275-
270+
276271
# Events
277272
def get_event(self, event):
278273
return self.get_single_feed(event, OPEN511, 'events/', EventFeedSerializer)
@@ -326,7 +321,7 @@ def get_high_elevation_forecast_list(self):
326321
try:
327322
response = self.make_weather_request(area_code_endpoint)
328323
response.raise_for_status()
329-
json_response = response.json()
324+
json_response = response.json()
330325

331326
for entry in json_response:
332327
# only high elevation ares will return anything; skip others
@@ -398,11 +393,10 @@ def get_high_elevation_forecast_list(self):
398393
except requests.RequestException as e:
399394
logging.exception(f"Error making API call for Area Code {area_code}: {e}")
400395

401-
402396
except requests.RequestException as e:
403397
logging.exception(f"Error fetching data from weather API: {e}")
404-
405-
return json_objects
398+
399+
return json_objects
406400

407401
# Current Weather
408402
def get_current_weather_list_feed(self, serializer_cls, token):

0 commit comments

Comments
 (0)