Skip to content

Commit c80bab3

Browse files
rabingairerabin.gaire
andauthored
fix: KeyError exception in athena wrangler (#2483)
When updating cache on a multi thread code we got an KeyError exception. Now have updated code to only remove the item in cache if key actually exists. Co-authored-by: rabin.gaire <[email protected]>
1 parent c71158b commit c80bab3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

awswrangler/athena/_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def update_cache(self, items: List[Dict[str, Any]]) -> None:
5858
cache_oversize = len(self._cache) + len(items) - self._max_cache_size
5959
for _ in range(cache_oversize):
6060
_, query_execution_id = heappop(self._pqueue)
61-
del self._cache[query_execution_id]
61+
self._cache.pop(query_execution_id, None)
6262

6363
for item in items[: self._max_cache_size]:
6464
heappush(self._pqueue, (item["Status"]["SubmissionDateTime"], item["QueryExecutionId"]))

0 commit comments

Comments
 (0)