Skip to content

Commit afffe65

Browse files
kiberguscopybara-github
authored andcommitted
Avoid crashes when key already exists in the DB.
PiperOrigin-RevId: 902661351
1 parent 5e9d9bb commit afffe65

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

genai_processors/sql_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ async def put(
195195
item.value = data_to_cache_bytes
196196
item.expires_at = expires_at
197197
async with self._lock:
198-
self._session.add(item)
198+
await self._session.merge(item)
199199
await self._cleanup_expired()
200200
await self._session.commit()
201201

0 commit comments

Comments
 (0)