rename Rendezvous.prune() to prune_all_apps
so grep can distinguish it from Mailbox.prune()
This commit is contained in:
parent
b8521e81b1
commit
08443ee288
|
@ -518,7 +518,7 @@ class Rendezvous(service.MultiService):
|
||||||
log_requests = blur_usage is None
|
log_requests = blur_usage is None
|
||||||
self._log_requests = log_requests
|
self._log_requests = log_requests
|
||||||
self._apps = {}
|
self._apps = {}
|
||||||
t = internet.TimerService(EXPIRATION_CHECK_PERIOD, self.prune)
|
t = internet.TimerService(EXPIRATION_CHECK_PERIOD, self.prune_all_apps)
|
||||||
t.setServiceParent(self)
|
t.setServiceParent(self)
|
||||||
|
|
||||||
def get_welcome(self):
|
def get_welcome(self):
|
||||||
|
@ -549,7 +549,7 @@ class Rendezvous(service.MultiService):
|
||||||
apps.add(row["app_id"])
|
apps.add(row["app_id"])
|
||||||
return apps
|
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.
|
# As with AppNamespace.prune_old_mailboxes, we log for now.
|
||||||
log.msg("beginning app prune")
|
log.msg("beginning app prune")
|
||||||
now = now or time.time()
|
now = now or time.time()
|
||||||
|
|
|
@ -321,7 +321,7 @@ class Prune(unittest.TestCase):
|
||||||
app = rv.get_app("appid")
|
app = rv.get_app("appid")
|
||||||
app.allocate_nameplate("side", 121)
|
app.allocate_nameplate("side", 121)
|
||||||
app.prune = mock.Mock()
|
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)])
|
self.assertEqual(app.prune.mock_calls, [mock.call(123, 122)])
|
||||||
|
|
||||||
def test_active(self):
|
def test_active(self):
|
||||||
|
@ -366,7 +366,7 @@ class Prune(unittest.TestCase):
|
||||||
app.claim_nameplate("np-5", "side2", 61)
|
app.claim_nameplate("np-5", "side2", 61)
|
||||||
new_nameplates.add("np-5")
|
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
|
nameplates = set([row["name"] for row in
|
||||||
db.execute("SELECT * FROM `nameplates`").fetchall()])
|
db.execute("SELECT * FROM `nameplates`").fetchall()])
|
||||||
|
@ -400,7 +400,7 @@ class Prune(unittest.TestCase):
|
||||||
app.open_mailbox("mb-15", "side2", 61)
|
app.open_mailbox("mb-15", "side2", 61)
|
||||||
new_mailboxes.add("mb-15")
|
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
|
mailboxes = set([row["id"] for row in
|
||||||
db.execute("SELECT * FROM `mailboxes`").fetchall()])
|
db.execute("SELECT * FROM `mailboxes`").fetchall()])
|
||||||
|
@ -453,7 +453,7 @@ class Prune(unittest.TestCase):
|
||||||
mailbox_survives = True
|
mailbox_survives = True
|
||||||
messages_survive = mailbox_survives
|
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
|
nameplates = set([row["name"] for row in
|
||||||
db.execute("SELECT * FROM `nameplates`").fetchall()])
|
db.execute("SELECT * FROM `nameplates`").fetchall()])
|
||||||
|
@ -995,14 +995,14 @@ class Summary(unittest.TestCase):
|
||||||
APPID = "appid"
|
APPID = "appid"
|
||||||
app = rv.get_app(APPID)
|
app = rv.get_app(APPID)
|
||||||
app.claim_nameplate("npid", "side1", 10) # start time is 10
|
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)
|
# start time should be rounded to top of the hour (blur_usage=3600)
|
||||||
row = db.execute("SELECT * FROM `nameplate_usage`").fetchone()
|
row = db.execute("SELECT * FROM `nameplate_usage`").fetchone()
|
||||||
self.assertEqual(row["started"], 0)
|
self.assertEqual(row["started"], 0)
|
||||||
|
|
||||||
app = rv.get_app(APPID)
|
app = rv.get_app(APPID)
|
||||||
app.open_mailbox("mbid", "side1", 20) # start time is 20
|
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()
|
row = db.execute("SELECT * FROM `mailbox_usage`").fetchone()
|
||||||
self.assertEqual(row["started"], 0)
|
self.assertEqual(row["started"], 0)
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ class Summary(unittest.TestCase):
|
||||||
APPID = "appid"
|
APPID = "appid"
|
||||||
app = rv.get_app(APPID)
|
app = rv.get_app(APPID)
|
||||||
app.claim_nameplate("npid", "side1", 10) # start time is 10
|
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()
|
row = db.execute("SELECT * FROM `nameplate_usage`").fetchone()
|
||||||
self.assertEqual(row["started"], 10)
|
self.assertEqual(row["started"], 10)
|
||||||
|
|
||||||
|
@ -1020,7 +1020,7 @@ class Summary(unittest.TestCase):
|
||||||
db.commit()
|
db.commit()
|
||||||
app = rv.get_app(APPID)
|
app = rv.get_app(APPID)
|
||||||
app.open_mailbox("mbid", "side1", 20) # start time is 20
|
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()
|
row = db.execute("SELECT * FROM `mailbox_usage`").fetchone()
|
||||||
self.assertEqual(row["started"], 20)
|
self.assertEqual(row["started"], 20)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user