temporarily enable ndb context cache for everything

for #1149
pull/1683/head
Ryan Barrett 2025-01-12 08:11:29 -08:00
rodzic 2437a16b1e
commit 18aa302dac
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -390,12 +390,14 @@ def cache_policy(key):
Returns:
bool: whether to cache this object
"""
if isinstance(key, Key):
# use internal google.cloud.datastore.key.Key
# https://github.com/googleapis/python-ndb/issues/987
key = key._key
return True
return key and key.kind == 'Object' and key.name.startswith('did:')
# if isinstance(key, Key):
# # use internal google.cloud.datastore.key.Key
# # https://github.com/googleapis/python-ndb/issues/987
# key = key._key
# return key and key.kind == 'Object' and key.name.startswith('did:')
def global_cache_policy(key):

Wyświetl plik

@ -1,4 +1,5 @@
"""Unit tests for common.py."""
from unittest import skip
from unittest.mock import Mock, patch
import flask
@ -112,6 +113,7 @@ class CommonTest(TestCase):
with app.test_request_context(base_url='https://bsky.brid.gy', path='/foo'):
self.assertEqual('https://bsky.brid.gy/asdf', common.host_url('asdf'))
@skip
def test_cache_policy(self):
for id in 'did:plc:foo', 'did:web:foo':
self.assertTrue(common.cache_policy(Object(id=id).key))