Fix overzealous saving/clearing of the siteconfig cache for avatar settings.

Review Request #8874 — Created April 5, 2017 and submitted

Information

Djblets
release-0.10.x
82acd93...

Reviewers

When populating the avatars registry, the list of enabled backends and
the default backend are saved into the siteconfig, which then results in
the siteconfig being dirty. This can cause the siteconfig cache to be
emptied too often, as it's being cleared on all threads every time a new
thread spins up, along with a couple times during initial setup of the
avatar support.

Now the settings are conditionally written to the siteconfig only if
they've changed, ensuring we don't save unless we have something useful
to save

Unit tests pass.

No longer saw my debug info showing the siteconfig cache was being
cleared, or the extra siteconfig database queries.

Description From Last Updated

We chould compare self._enabled_services (as a set) to set(siteconfig.get(self.ENABLED_SERVICES_KEY) to ensure they are not differing only by order.

brenniebrennie
brennie
  1. Ship It!
  2. 
      
brennie
  1. 
      
  2. djblets/avatars/registry.py (Diff revision 1)
     
     
    Show all issues

    We chould compare self._enabled_services (as a set) to set(siteconfig.get(self.ENABLED_SERVICES_KEY) to ensure they are not differing only by order.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.10.x (398b502)