Skip to content

Commit bd2365e

Browse files
Fix bug that leads to caching invalid responses on the disk (#259)
* Temporarily disable caching to avoid saving invalid responses on the disk * Fix and reenable HTTP cache * Changelog
1 parent 38875d5 commit bd2365e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Please use [this](https://docs.gitlab.com/ee/development/changelog.html) documen
77
### Fixed
88

99
* database: Fixed generating table names from uppercase model names.
10+
* http: Fixed bug that leads to caching invalid responses on the disk.
1011
* tzkt: Fixed processing realtime messages with data from multiple levels.
1112

1213
## 4.2.5 - 2022-02-21

src/dipdup/http.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ async def request(
188188
Check for parameters in cache, if not found, perform retried request and cache result.
189189
"""
190190
if self._config.cache and cache:
191-
key = hashlib.sha256(pickle.dumps([method, url, kwargs])).hexdigest()
191+
# NOTE: Don't forget to include base gateway URL in the cache key
192+
key_data = (method, self._url, url, kwargs)
193+
key = hashlib.sha256(pickle.dumps(key_data)).hexdigest()
192194
try:
193195
return self._cache[key]
194196
except KeyError:

0 commit comments

Comments
 (0)