Stop reloading siteconfigs on every request, and fix log reloads.

Review Request #5931 — Created June 4, 2014 and submitted

Information

Review Board
master
218ad01...

Reviewers

We were reloading siteconfigs on every single request, which was
unnecessary. It was only necessary to reload if the siteconfig had
changed since it was last used. This wasn't particularly time-consuming,
but it was extra work that shouldn't be needed, and it made it hard to
handle reloads of logging.

To track whether a siteconfig should be reloaded, we now check a private
flag on the SiteConfiguration. If it's not set, we perform a full reload
(which now restarts logging as well, something that was missing and hard
to do correctly before). If it is set, we do nothing.

Browsed around the site a bit and checked things affected by settings.

Reloaded settings and saw it go through the reload path.

Tested a multi-process setup:

  1. Set up two devservers on two different ports, each connected to a single memcached.

  2. Loaded a page on both. Saw the initial log messages about writing to /tmp/reviewboard.log.

  3. Changed log settings on server1 to point to ~/reviewboard.log. Saw it reload the siteconfig
    and output the new log destination as part of that request.

  4. Loaded a page on server2, and saw it reload logging, pointing to the new location.

  5. Changed the logging destination back to /tmp/reviewboard.log on server2. Saw it reload and
    output the /tmp location.

  6. Loaded a page on server1, and saw it reload logging, pointing to the new location.

Description From Last Updated

'restart_logging' imported but unused

reviewbotreviewbot
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/admin/siteconfig.py
        reviewboard/admin/forms.py
        reviewboard/admin/middleware.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/admin/siteconfig.py
        reviewboard/admin/forms.py
        reviewboard/admin/middleware.py
      Ignored Files:
    
    
  2. reviewboard/admin/forms.py (Diff revision 1)
     
     
    Show all issues
     'restart_logging' imported but unused
    
  3. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/admin/siteconfig.py
        reviewboard/admin/forms.py
        reviewboard/admin/middleware.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/admin/siteconfig.py
        reviewboard/admin/forms.py
        reviewboard/admin/middleware.py
      Ignored Files:
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (a5f90de)