Attempt to fix DynamicURLResolver with threads.

Review Request #6606 — Created Nov. 18, 2014 and submitted

Information

Djblets
release-0.8.x
3ec8d51...

Reviewers

We had some occasional bugs where Django would fail to look up items
from URL resolvers, generating a HTTP 500. This is likely due to a
lookup occurring while the cache is being cleared.

This change attempts to improve the way we handle clearing of caches.
Instead of wiping the entries and expecting Django's URLResolvers to
rebuild them when appropriate, we now directly call their _repopulate()
method. This method will generate new copies of the dictionaries and
then immediately set them, without leaving any time where the
dictionaries would be empty.

This should ensure that a valid lookup will always succeed, without any
risk of the types of failures we've seen.

It also surrounds this in a lock, hopefully preventing any clashes
during the repopulation process.

Unit tests pass.

Description From Last Updated

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/urls/resolvers.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/urls/resolvers.py
    
    
  2. djblets/urls/resolvers.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.8.x (ceb133e)
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (ceb133e)