Object._post_put_hook: use objects_cache_lock for objects_cache

fixes https://console.cloud.google.com/errors/detail/CMv025380KiFOg?project=bridgy-federated
pull/1094/head
Ryan Barrett 2024-05-27 20:31:23 -07:00
rodzic 2dc693d654
commit 0a3976e33a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -900,10 +900,11 @@ class Object(StringIdModel):
# make a copy so that if we later modify this object in memory,
# those modifications don't affect the cache.
# NOTE: keep in sync with Protocol.load!
protocol.objects_cache[self.key.id()] = Object(
id=self.key.id(),
# exclude computed properties
**self.to_dict(exclude=['as1', 'expire', 'object_ids', 'type']))
with protocol.objects_cache_lock:
protocol.objects_cache[self.key.id()] = Object(
id=self.key.id(),
# exclude computed properties
**self.to_dict(exclude=['as1', 'expire', 'object_ids', 'type']))
@classmethod
def get_by_id(cls, id):