I'm working for an organization which uses a Bitbucket account with over 200 repositories (unlimited users account). We're using also a jenkins server for our continuous integration.
Each configured job may have some polling to watch for changes. There is therefore a lot of processes started and many queries sent to Bitbucket.
I'm sure you're aware of this kind of feature.
I'm also sure the resulting load is very expensive ...
We would like to use Bitbucket hook but our context does not allow us to create this king of incoming flow.
I had the idea to call Bitbucket API to get last updated job and therefore notify jenkins for that changes. This work really nice and decrease the number of processes and requests from ~200 by minutes to 1 or 2 by minutes (depending on the API pagination).
I used the API v2 which allow to list all Bitbucket repositories for an account and I'm using the updated_on field to define which repositories have been modified since my last call.
https://api.bitbucket.org/2.0/repositories/" + account + "?pagelen=100
and call json.next if there's more repositories ...
I think this is a misuse of this API and getting a dedicated API will be more efficient and sustainable. For example :