1. Adopt OpenJDK
  2. Untitled project
  3. Betterrev
Issue #59 on hold

Bitbucket poller isn't consistent

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. 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 (https://bitbucket.org/api/2.0/repositories/egwor/better-test-repo/pullrequests/?owner=egwor) via the Atlassian test web url http://restbrowser.bitbucket.org/ 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

  2. Erik van Zijst staff

    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.

  3. 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?

  4. Erik van Zijst staff

    Ed Bateman 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).

  5. Log in to comment