Fix stale SiteConfigurations when using a web server with multiple worker processes

Review Request #619 — Created Nov. 1, 2008 and submitted


Navi (deprecated)


We had issues with the siteconfig framework and multiple web server worker processes where the user would save the settings on one process and then see their settings not take effect reliably. This appears to be due to how we cache the settings in a SiteConfiguration. We attempt to update the existing locally cached SiteConfiguration, hoping that all requests will use that, but in a setup with multiple server processes, we just end up with multiple SiteConfigurations, most of which never get updated.

With this change and my accompanying change for Review Board, we now check on each request if the SiteConfiguration has expired. We know this based on a timestamp we store in the cache (using memcache or whatever is being used on that server). If the timestamp does not exist in the cache or is more recent than the SiteConfiguration's timestamp, we invalidate the SiteConfiguration early and force it to reload when next needed.
Checked that a single instance never invalidates its SiteConfiguration but that with multiple instances, we do invalidate when a SiteConfiguration is saved.