In our developer instance, we frequently run into a rate limit error:
Too many connections! The tunnel session ‘ts_1iBCo7ybm87qriNcOVxphBK3rue’ has violated the rate-limit policy of 20 connections per minute by initiating 30 connections in the last 60 seconds. Please decrease your inbound connection volume or upgrade to a paid plan for additional capacity.
20 connections per minute doesn’t seem very much, since we already need 5-6 rest API calls for each embedded macro (see the context information about the macro below). So 4 embeddings would already trigger the rate limit on page load.
Is this limit lower for developer instances of confluence cloud (http://go.atlassian.com/cloud-dev)?
And how to deal with this? Do we need to try the requests until all have finished successfully? However, this would result in a really odd user-experience where macros load awfully slow (~4 embeddings per minute?!).
Also, I’m not sure how to workaround the error page about the rate limit that is shown as soon as the rate limit is hit?
More context information about the dynamic macro
The macro embeds an SVG attachment in a Confluence Page and also provides buttons to open an editor (if the user has write access to the page) in order to edit the embedding and eventually update the attachment.
- REQUEST macro body (to read some macro settings, e.g. whether to display a title for the embedding).
REQUEST restrictions (to identify whether the user can edit the embedded diagram or only view it as embedding and show the appropriate buttons).
More requests are necessary to check the current user against the page restrictions
- GET current user id (AP.user.getCurrentUser… guess this is a REST API call that counts against the limit?)
- If the page has group restrictions, we need to inspect them as well
=> REQUEST group memberships of the current user and compare with the page restrictions
- REQUEST attachments on the confluence page and filter them for the related attachment file
REQUEST the actual attachment data (i.e. download the given URL from the attachment data ‘data._links.download’)
=> This yields an SVG that is embedded as image in the dynamic macro.