Use etags instead of timestamps for all API resources.

Review Request #6888 — Created Feb. 3, 2015 and submitted

Information

Review Board
release-2.0.x
7a00c6d...

Reviewers

A bug was found where fetching a review request API resource, then
closing an issue, and then fetching again would return the original
resource with the wrong information, if caching requests. This was due
to the resource's cache information being based on the last_modified
timestamp of the review request, and not factoring in other information.

While investigating, I realized there were numerous cases where a
timestamp was being used without in ways that would cause incorrect
stale caches, and that most resources had no caching at all.

This change fixes these problems by switching all resources to
etag-based caching. This adds a little overhead up-front to the request,
but means that the client can greatly benefit from caching on all
resources, without fear of the cached version being stale.

Unit tests pass.

Couldn't reproduce the caching problem I was hitting after this change.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/base.py
        reviewboard/webapi/resources/base_file_attachment.py
        reviewboard/webapi/resources/base_comment.py
        reviewboard/webapi/resources/repository.py
        reviewboard/webapi/tests/test_draft_diff.py
        reviewboard/webapi/tests/test_change.py
        reviewboard/webapi/resources/base_screenshot.py
        reviewboard/webapi/resources/review_group.py
        reviewboard/webapi/tests/test_diff.py
        reviewboard/webapi/resources/change.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
        reviewboard/webapi/resources/default_reviewer.py
        reviewboard/webapi/resources/base_review.py
        reviewboard/webapi/tests/test_review_comment.py
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/test_review.py
        reviewboard/webapi/tests/test_review_reply.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/base.py
        reviewboard/webapi/resources/base_file_attachment.py
        reviewboard/webapi/resources/base_comment.py
        reviewboard/webapi/resources/repository.py
        reviewboard/webapi/tests/test_draft_diff.py
        reviewboard/webapi/tests/test_change.py
        reviewboard/webapi/resources/base_screenshot.py
        reviewboard/webapi/resources/review_group.py
        reviewboard/webapi/tests/test_diff.py
        reviewboard/webapi/resources/change.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
        reviewboard/webapi/resources/default_reviewer.py
        reviewboard/webapi/resources/base_review.py
        reviewboard/webapi/tests/test_review_comment.py
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/test_review.py
        reviewboard/webapi/tests/test_review_reply.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (e9e477b)