Bitbucket poller isn't consistent

Create issue
Issue #59 on hold
Mani Sarkar created an issue

Whilst setting up Betterrev recently and testing it against these two scenarios:

  • A new Pull Review has been created from client account into Adopt OpenJDK organisation
  • Existing Pull Review has been deleted between the client account and the Adopt OpenJDK organisation

It came to light that the GUI wouldn't populate all the actual pull requests under the Pull Reviews page even though the respective entr(ies) was added and available (or removed) from the Adopt OpenJDK's Pull Reviews's list on Bitbucket.

Workaround: stop Play, wait for a bit, restart play and reload the Betterrev Pull Reviews page.

Comments (9)

  1. Mani Sarkar reporter

    @egwor is going to work on this issue, has been able to reproduce it. @danielbryant_uk will be adding him to the #adoptopenjdk organisation shortly.

  2. Ed Bateman

    So the poller will make a call to the Bitbucket API every X seconds (defined in the application config). We debugged through after making both new pull requests and amending requests in a test repo and found that the results were stale from the API. We suspect caching.

    Scenarios tested where the updates were not immediate

    (in fact we saw update delays of at least 15 minutes)

    1. Create new pull request
    2. Update pull request

    How we validated the scenario:

    1. Debugged locally in IntelliJ on running app
    2. Checked once the application had been restarted
    3. Checked on a different machine (different IP address) using wget
    4. Checked the URL ( via the Atlassian test web url and they showed the stale data

    Why is the delay 15 minutes?

    It looks like the web page headers say that the page expires after 15 minutes

    I'll ping the atlassian support guys and find out more

  3. Erik van Zijst

    Anonymous GET and HEAD requests on the API are cached for a maximum of 15 minutes. If this is a problem then you can make authenticated requests for which the response will never get cached.

    Note that if you are seeing stale responses that are more than 15 minutes old and can reporoduce this, do let me know though.

  4. Ed Bateman

    Thanks for the response Erik. Is there a way to get an application login (rather than a 'real user' authenticated one?). For test we could use the anonymous but for production we could use an application login?

  5. Erik van Zijst

    @egwor team accounts have API tokens that you could use (you'd still effectively be authenticating as the team account itself):

    If the repo in question is not owned by a regular user account, then you'll just have to authenticate as a regular user (that has read access to the repo in case it's private).

  6. Log in to comment