[nominatim-web] Revert pipeline usage
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nominatim-web] Revert pipeline usage
- Date: Sat, 10 Apr 2021 13:18:31 +0000 (UTC)
commit 49761bfaf577db31ff37cf94d9ca41454d7e3f77
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Sat Apr 10 15:16:51 2021 +0200
Revert pipeline usage
app/main.py | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/app/main.py b/app/main.py
index 0627ac9..90bb33b 100644
--- a/app/main.py
+++ b/app/main.py
@@ -64,10 +64,9 @@ def search(request: Request):
key = f"search:{lang}:{limit}:{location}:{query}"
- with redis_conn.pipeline() as redis_pipeline:
- if resp := redis_pipeline.get(key):
- redis_pipeline.expire(key, 600)
- return Response(content=resp, media_type="application/json")
+ if resp := redis_conn.get(key):
+ redis_conn.expire(key, 600)
+ return Response(content=resp, media_type="application/json")
with postgres_ro.cursor() as cur:
cur.execute("SELECT * FROM search WHERE key = %s", (key,))
@@ -105,11 +104,9 @@ def reverse(request: Request):
lang = request.query_params.get("accept-language", "none")
key = f"rev:{lang}:{lat}x{lon}"
-
- with redis_conn.pipeline() as redis_pipeline:
- if resp := redis_pipeline.get(key):
- redis_pipeline.expire(key, 600)
- return Response(content=resp, media_type="application/json")
+ if resp := redis_conn.get(key):
+ redis_conn.expire(key, 600)
+ return Response(content=resp, media_type="application/json")
with postgres_ro.cursor() as cur:
cur.execute("SELECT * FROM reverse WHERE key = %s", (key,))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]