launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #16302
[Merge] lp:~stub/launchpad/trivial into lp:launchpad
Stuart Bishop has proposed merging lp:~stub/launchpad/trivial into lp:launchpad.
Commit message:
Fix changing the refresh time of the Twisted Feature Flag cache.
Requested reviews:
Stuart Bishop (stub)
Related bugs:
Bug #951401 in Launchpad itself: "parse-ppa-apache-logs failing (missing files)"
https://bugs.launchpad.net/launchpad/+bug/951401
Bug #1263002 in Launchpad itself: "Twisted feature flag support fails typecasting when updating"
https://bugs.launchpad.net/launchpad/+bug/1263002
For more details, see:
https://code.launchpad.net/~stub/launchpad/trivial/+merge/199767
Fix changing the refresh time of the Twisted Feature Flag cache.
--
https://code.launchpad.net/~stub/launchpad/trivial/+merge/199767
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/services/twistedsupport/features.py'
--- lib/lp/services/twistedsupport/features.py 2013-08-08 08:49:04 +0000
+++ lib/lp/services/twistedsupport/features.py 2013-12-20 09:05:13 +0000
@@ -14,6 +14,7 @@
reactor,
)
from twisted.internet.threads import deferToThread
+from twisted.python import log
from lp.services.database import read_transaction
from lp.services.features import (
@@ -46,7 +47,23 @@
return controller
+_last_refresh = None
+
+
def _install_and_reschedule(controller, script_name):
install_feature_controller(controller)
- reactor.callLater(
- getFeatureFlag('twisted.flags.refresh') or 30, update, script_name)
+ refresh = getFeatureFlag('twisted.flags.refresh') or 60.0
+ try:
+ refresh = float(refresh)
+ except ValueError:
+ log.msg("Invalid value {0!r} for twisted.flags.refresh".format(
+ refresh))
+ refresh = 60.0
+
+ global _last_refresh
+ if refresh != _last_refresh:
+ if _last_refresh is not None:
+ log.msg("twisted.flags.refresh changed to {0}".format(refresh))
+ _last_refresh = refresh
+
+ reactor.callLater(refresh, update, script_name)
References