From 08443ee288046c493fc8e848427b6dab3b8ba43b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 20 Jun 2016 18:00:20 -0700 Subject: [PATCH] rename Rendezvous.prune() to prune_all_apps so grep can distinguish it from Mailbox.prune() --- src/wormhole/server/rendezvous.py | 4 ++-- src/wormhole/test/test_server.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/wormhole/server/rendezvous.py b/src/wormhole/server/rendezvous.py index b5ef894..5b15cf4 100644 --- a/src/wormhole/server/rendezvous.py +++ b/src/wormhole/server/rendezvous.py @@ -518,7 +518,7 @@ class Rendezvous(service.MultiService): log_requests = blur_usage is None self._log_requests = log_requests self._apps = {} - t = internet.TimerService(EXPIRATION_CHECK_PERIOD, self.prune) + t = internet.TimerService(EXPIRATION_CHECK_PERIOD, self.prune_all_apps) t.setServiceParent(self) def get_welcome(self): @@ -549,7 +549,7 @@ class Rendezvous(service.MultiService): apps.add(row["app_id"]) return apps - def prune(self, now=None, old=None): + def prune_all_apps(self, now=None, old=None): # As with AppNamespace.prune_old_mailboxes, we log for now. log.msg("beginning app prune") now = now or time.time() diff --git a/src/wormhole/test/test_server.py b/src/wormhole/test/test_server.py index 9ef491c..f91adb9 100644 --- a/src/wormhole/test/test_server.py +++ b/src/wormhole/test/test_server.py @@ -321,7 +321,7 @@ class Prune(unittest.TestCase): app = rv.get_app("appid") app.allocate_nameplate("side", 121) app.prune = mock.Mock() - rv.prune(now=123, old=122) + rv.prune_all_apps(now=123, old=122) self.assertEqual(app.prune.mock_calls, [mock.call(123, 122)]) def test_active(self): @@ -366,7 +366,7 @@ class Prune(unittest.TestCase): app.claim_nameplate("np-5", "side2", 61) new_nameplates.add("np-5") - rv.prune(now=123, old=50) + rv.prune_all_apps(now=123, old=50) nameplates = set([row["name"] for row in db.execute("SELECT * FROM `nameplates`").fetchall()]) @@ -400,7 +400,7 @@ class Prune(unittest.TestCase): app.open_mailbox("mb-15", "side2", 61) new_mailboxes.add("mb-15") - rv.prune(now=123, old=50) + rv.prune_all_apps(now=123, old=50) mailboxes = set([row["id"] for row in db.execute("SELECT * FROM `mailboxes`").fetchall()]) @@ -453,7 +453,7 @@ class Prune(unittest.TestCase): mailbox_survives = True messages_survive = mailbox_survives - rv.prune(now=123, old=50) + rv.prune_all_apps(now=123, old=50) nameplates = set([row["name"] for row in db.execute("SELECT * FROM `nameplates`").fetchall()]) @@ -995,14 +995,14 @@ class Summary(unittest.TestCase): APPID = "appid" app = rv.get_app(APPID) app.claim_nameplate("npid", "side1", 10) # start time is 10 - rv.prune(now=123, old=50) + rv.prune_all_apps(now=123, old=50) # start time should be rounded to top of the hour (blur_usage=3600) row = db.execute("SELECT * FROM `nameplate_usage`").fetchone() self.assertEqual(row["started"], 0) app = rv.get_app(APPID) app.open_mailbox("mbid", "side1", 20) # start time is 20 - rv.prune(now=123, old=50) + rv.prune_all_apps(now=123, old=50) row = db.execute("SELECT * FROM `mailbox_usage`").fetchone() self.assertEqual(row["started"], 0) @@ -1012,7 +1012,7 @@ class Summary(unittest.TestCase): APPID = "appid" app = rv.get_app(APPID) app.claim_nameplate("npid", "side1", 10) # start time is 10 - rv.prune(now=123, old=50) + rv.prune_all_apps(now=123, old=50) row = db.execute("SELECT * FROM `nameplate_usage`").fetchone() self.assertEqual(row["started"], 10) @@ -1020,7 +1020,7 @@ class Summary(unittest.TestCase): db.commit() app = rv.get_app(APPID) app.open_mailbox("mbid", "side1", 20) # start time is 20 - rv.prune(now=123, old=50) + rv.prune_all_apps(now=123, old=50) row = db.execute("SELECT * FROM `mailbox_usage`").fetchone() self.assertEqual(row["started"], 20)