Add a signal for detecting reloaded SiteConfigurations.
Review Request #9481 — Created Jan. 13, 2018 and submitted — Latest diff uploaded
This introduces a
siteconfig_reloaded
signal, which consumers can
listen to in order to update their state when aSiteConfiguration
has
expired and has been reloaded. The signal contains the new instance,
along with the old instance for settings comparison purposes.A couple of changes were made to enable use of this signal.
First, the behavior of
SiteConfigurationManager.check_expired
has
slightly changed. Previously, expiration just meant clearing the value
from cache, causing the nextget_current()
to re-fetch. Now, if there
are any listeners for the signal, the new instance is fetched
immediately, so that it can be passed to the signal handler. This
shouldn't impact any consumers. If no listeners are present, the new
instance is not fetched.A new method
get_for_site_id()
method was also added for use in
check_expired()
. This works likeget_current()
, but takes the ID of
a DjangoSite
, handling caching.get_current()
wraps this.The docs throughout the file have been modernized, helping to keep this
maintainable going forward.
All unit tests for Djblets and Review Board pass.