pymemcache fixture
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m56s
Run linting on the backend code / Build (pull_request) Successful in 29s
Run testing on the backend code / Build (pull_request) Failing after 1m59s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 19s
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m56s
Run linting on the backend code / Build (pull_request) Successful in 29s
Run testing on the backend code / Build (pull_request) Failing after 1m59s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 19s
This commit is contained in:
parent
291edcfc2a
commit
2033941953
@ -132,14 +132,6 @@ def get_landmark(landmark_uuid: str) -> Landmark:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
landmark = cache_client.get(f"landmark_{landmark_uuid}")
|
landmark = cache_client.get(f"landmark_{landmark_uuid}")
|
||||||
if not isinstance(landmark, Landmark) :
|
|
||||||
raise HTTPException(status_code=500, detail=f"Object {landmark} is not of type Landmark")
|
|
||||||
return landmark
|
return landmark
|
||||||
except KeyError as exc:
|
except KeyError as exc:
|
||||||
raise HTTPException(status_code=404, detail="Landmark not found") from exc
|
raise HTTPException(status_code=404, detail="Landmark not found") from exc
|
||||||
except ConnectionError as exc:
|
|
||||||
raise HTTPException(status_code=503, detail="Service unavailable") from exc
|
|
||||||
except TimeoutError as exc:
|
|
||||||
raise HTTPException(status_code=504, detail="Request timed out") from exc
|
|
||||||
except Exception as exc:
|
|
||||||
raise HTTPException(status_code=500, detail="An unexpected error occurred") from exc
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Module used for handling cache"""
|
"""Module used for handling cache"""
|
||||||
|
from pymemcache import serde
|
||||||
from pymemcache.client.base import Client
|
from pymemcache.client.base import Client
|
||||||
|
|
||||||
from .constants import MEMCACHED_HOST_PATH
|
from .constants import MEMCACHED_HOST_PATH
|
||||||
@ -70,5 +70,6 @@ else:
|
|||||||
MEMCACHED_HOST_PATH,
|
MEMCACHED_HOST_PATH,
|
||||||
timeout=1,
|
timeout=1,
|
||||||
allow_unicode_keys=True,
|
allow_unicode_keys=True,
|
||||||
encoding='utf-8'
|
encoding='utf-8',
|
||||||
|
serde=serde.pickle_serde
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user