• Marc Treib's avatar
    PerUserTopicSubscriptionManager: Fix handling of 401 (unauthorized) errors · 447f5786
    Marc Treib authored
    On a 401 (HTTP unauthorized) error, the correct response it to get a
    new access token and try again (most likely reason for the error is that
    the previous access token was expired).
    PerUserTopicSubscriptionManager did this, but SubscriptionEntry's
    SubscriptionFinishedCallback was a OnceCallback, and it wasn't re-set
    for the second subscription attempt. So the result of the second attempt
    was simply ignored: If it succeeded, we'd now be subscribed, but not
    know about it (likely resulting in a redundant subscription request at
    some later time). If it failed, it wouldn't get retried anymore, so
    invalidations would be broken until at least the next Chrome restart.
    
    This CL fixes this by simply making the callback a RepeatingCallback. It
    also adds a test.
    
    Bug: 1020117
    Change-Id: Ifaf29a6db21ce9f37888603b534ef50970ffc94f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2000720
    Commit-Queue: Marc Treib <treib@chromium.org>
    Reviewed-by: default avatarTim Schumann <tschumann@chromium.org>
    Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#732055}
    447f5786
per_user_topic_subscription_manager.cc 22 KB