search-fix
This commit is contained in:
parent
9cfad11df2
commit
a71cf3e9fc
|
@ -17,7 +17,7 @@ class SearchService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def search(text, limit, offset) -> [Shout]:
|
async def search(text, limit, offset) -> [Shout]:
|
||||||
cached = redis.execute("GET", text)
|
cached = await redis.execute("GET", text)
|
||||||
if not cached:
|
if not cached:
|
||||||
async with SearchService.lock:
|
async with SearchService.lock:
|
||||||
by = {
|
by = {
|
||||||
|
@ -25,7 +25,7 @@ class SearchService:
|
||||||
"body": text
|
"body": text
|
||||||
}
|
}
|
||||||
payload = await load_shouts_by(None, None, by, limit, offset)
|
payload = await load_shouts_by(None, None, by, limit, offset)
|
||||||
redis.execute("SET", text, json.dumps(payload))
|
await redis.execute("SET", text, json.dumps(payload))
|
||||||
return payload
|
return payload
|
||||||
else:
|
else:
|
||||||
return json.loads(cached)
|
return json.loads(cached)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user