[nominatim-web] Revert pipeline usage



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]