diff --git a/autopush/router/simple.py b/autopush/router/simple.py index 4f55b2d5..266b775f 100644 --- a/autopush/router/simple.py +++ b/autopush/router/simple.py @@ -7,7 +7,6 @@ """ import json import requests -import time from urllib import urlencode from StringIO import StringIO @@ -15,7 +14,6 @@ ItemNotFound, ProvisionedThroughputExceededException, ) -from repoze.lru import LRUCache from twisted.internet.threads import deferToThread from twisted.internet.defer import ( inlineCallbacks, @@ -36,14 +34,6 @@ ) -dead_cache = LRUCache(150) - - -def node_key(node_id): - """Generate a node key for the dead node cache""" - return node_id + "-%s" % int(time.time() / 3600) - - class SimpleRouter(object): """Implements :class:`autopush.router.interface.IRouter` for internal routing to an Autopush node @@ -102,7 +92,6 @@ def route_notification(self, notification, uaid_data): notification) except (ConnectError, UserError, ConnectionRefusedError) as exc: self.metrics.increment("updates.client.host_gone") - dead_cache.put(node_key(node_id), True) yield deferToThread(router.clear_node, uaid_data).addErrback(self._eat_db_err) if isinstance(exc, ConnectionRefusedError): @@ -159,7 +148,6 @@ def route_notification(self, notification, uaid_data): result = yield self._send_notification_check(uaid, node_id) except (ConnectError, UserError, ConnectionRefusedError) as exc: self.metrics.increment("updates.client.host_gone") - dead_cache.put(node_key(node_id), True) if isinstance(exc, ConnectionRefusedError): self.log.debug("Could not route message: {exc}", exc=exc) yield deferToThread( diff --git a/autopush/tests/test_router.py b/autopush/tests/test_router.py index 9318f75f..a1d7be7c 100644 --- a/autopush/tests/test_router.py +++ b/autopush/tests/test_router.py @@ -25,7 +25,6 @@ from autopush.router import (APNSRouter, GCMRouter, SimpleRouter, WebPushRouter, FCMRouter) -from autopush.router.simple import dead_cache from autopush.router.interface import RouterException, RouterResponse, IRouter from autopush.settings import AutopushSettings @@ -724,9 +723,6 @@ def setUp(self): settings.agent = self.agent_mock self.router.metrics = Mock() - def tearDown(self): - dead_cache.clear() - def _raise_connect_error(self): raise ConnectError() @@ -861,7 +857,6 @@ def verify_deliver(result): return d def test_route_to_busy_node_saves_looks_up_and_send_check_fails(self): - import autopush.router.simple as simple response_mock = Mock() self.agent_mock.request.side_effect = MockAssist( [response_mock, self._raise_connection_refused_error]) @@ -876,13 +871,10 @@ def verify_deliver(result): ok_(isinstance(result, RouterResponse)) eq_(result.status_code, 202) assert(self.router_mock.clear_node.called) - nk = simple.node_key(router_data["node_id"]) - eq_(simple.dead_cache.get(nk), True) d.addBoth(verify_deliver) return d def test_route_busy_node_saves_looks_up_and_send_check_fails_and_db(self): - import autopush.router.simple as simple response_mock = Mock() self.agent_mock.request.side_effect = MockAssist( [response_mock, self._raise_connect_error]) @@ -900,8 +892,6 @@ def verify_deliver(result): ok_(isinstance(result, RouterResponse)) eq_(result.status_code, 202) assert(self.router_mock.clear_node.called) - nk = simple.node_key(router_data["node_id"]) - eq_(simple.dead_cache.get(nk), True) d.addBoth(verify_deliver) return d diff --git a/doc-requirements.txt b/doc-requirements.txt index 718c231b..7f6ee616 100644 --- a/doc-requirements.txt +++ b/doc-requirements.txt @@ -46,7 +46,6 @@ pyflakes==1.2.3 python-dateutil==2.5.3 python-jose==0.6.1 raven==5.16.0 -repoze.lru==0.6 requests==2.10.0 service-identity==16.0.0 simplejson==3.8.2 diff --git a/pypy-requirements.txt b/pypy-requirements.txt index 9c670ca4..cef10dff 100644 --- a/pypy-requirements.txt +++ b/pypy-requirements.txt @@ -45,7 +45,6 @@ pyflakes==1.2.3 python-dateutil==2.5.3 python-jose==0.6.1 raven==5.16.0 -repoze.lru==0.6 requests==2.10.0 service-identity==16.0.0 simplejson==3.8.2 diff --git a/requirements.txt b/requirements.txt index 9c670ca4..cef10dff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -45,7 +45,6 @@ pyflakes==1.2.3 python-dateutil==2.5.3 python-jose==0.6.1 raven==5.16.0 -repoze.lru==0.6 requests==2.10.0 service-identity==16.0.0 simplejson==3.8.2 diff --git a/test-requirements.txt b/test-requirements.txt index 36e51937..b4f0010b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -53,7 +53,6 @@ pyflakes==1.2.3 python-dateutil==2.5.3 python-jose==0.6.1 raven==5.16.0 -repoze.lru==0.6 requests==2.10.0 service-identity==16.0.0 simplejson==3.8.2