expire deleted Objects after just 1d instead of 90d

for #1703
pull/1999/head
Ryan Barrett 2025-07-16 20:24:48 -07:00
rodzic 12661b1938
commit 75e9a7ed1a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -24,7 +24,6 @@ from arroba.util import (
service_jwt,
TOMBSTONED,
)
import brevity
import dag_json
from flask import abort, redirect, request
from google.cloud import dns

Wyświetl plik

@ -1204,8 +1204,11 @@ class Object(StringIdModel, AddRemoveMixin):
They recommend not indexing TTL properties:
https://cloud.google.com/datastore/docs/ttl#ttl_properties_and_indexes
"""
if self.deleted or self.type not in DONT_EXPIRE_OBJECT_TYPES:
return (self.updated or util.now()) + OBJECT_EXPIRE_AGE
now = self.updated or util.now()
if self.deleted:
return now + timedelta(days=1)
elif self.type not in DONT_EXPIRE_OBJECT_TYPES:
return now + OBJECT_EXPIRE_AGE
expire = ndb.ComputedProperty(_expire, indexed=False)

Wyświetl plik

@ -880,7 +880,7 @@ class ObjectTest(TestCase):
self.assertIsNone(obj.expire)
obj.deleted = True
self.assertEqual(NOW + OBJECT_EXPIRE_AGE, obj.expire)
self.assertEqual(NOW + timedelta(days=1), obj.expire)
def test_as1_from_as2(self):
self.assert_equals({