diff --git a/autopush/db.py b/autopush/db.py index a11987cd..f8df639f 100644 --- a/autopush/db.py +++ b/autopush/db.py @@ -281,17 +281,9 @@ def create_router_table(tablename="router", read_throughput=5, ) table.meta.client.get_waiter('table_exists').wait( TableName=tablename) - try: - table.meta.client.update_time_to_live( - TableName=tablename, - TimeToLiveSpecification={ - 'Enabled': True, - 'AttributeName': 'expiry' - } - ) - except ClientError as ex: # pragma nocover - if ex.response["Error"]["Code"] != "UnknownOperationException": - raise + # Mobile devices (particularly older ones) do not have expiry and + # do not check in regularly. We don't know when they expire other than + # the bridge server failing the UID from their side. return table @@ -776,9 +768,8 @@ def get_uaid(self, uaid): # Incomplete record, drop it. self.drop_user(uaid) raise ItemNotFound("uaid not found") - if item.get("expiry") < _expiry(0): - self.drop_user(uaid) - raise ItemNotFound("uaid expired") + # Mobile users do not check in after initial registration. + # DO NOT EXPIRE THEM. return item except Boto3Error: # pragma: nocover # We trap JSONResponseError because Moto returns text instead of diff --git a/autopush/tests/test_db.py b/autopush/tests/test_db.py index 96da9e08..599b5602 100644 --- a/autopush/tests/test_db.py +++ b/autopush/tests/test_db.py @@ -524,18 +524,6 @@ def raise_error(*args, **kwargs): router_type="webpush")) assert res == (False, {}) - def test_register_user_expired(self): - from time import time - - router = Router(self.table_conf, SinkMetrics(), resource=self.resource) - expired = self._create_minimal_record() - uaid = expired["uaid"] - expired["expiry"] = int(time()) - 100 - self.router.register_user(expired) - with pytest.raises(ItemNotFound) as ex: - router.get_uaid(uaid) - assert ex.value.message == "uaid expired" - def test_clear_node_provision_failed(self): router = Router(self.table_conf, SinkMetrics(), resource=self.resource)