소스 검색

Don't cache empty profile

Zed 6 년 전
부모
커밋
f0db3a8bc2
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      src/redis_cache.nim

+ 1 - 0
src/redis_cache.nim

@@ -48,6 +48,7 @@ proc cache*(data: PhotoRail; id: string) {.async.} =
   await setex("pr:" & id, baseCacheTime, data.pack)
 
 proc cache*(data: Profile) {.async.} =
+  if data.username.len == 0: return
   pool.withAcquire(r):
     r.startPipelining()
     discard await r.setex(data.toKey, baseCacheTime, pack(data))