Skip to content

Create a throttled API

Edmund Smith requested to merge eds/throttling-cp into wip/sjoerd/job-logs-2

This is an equivalent API with a throttling mechanism on the top level calls. This only indirectly throttles the requests, because there are multiple API calls per top-level call, due to pagination. But throttling at a lower level is more difficult.

The core object that performs throttling offers permits, and each API call requires a permit to begin. The permit is passed down to the returned objects so that the permit is valid throughout all interaction with the LAVA server.

  • It only grants a restricted set of permits concurrently. Once all permits are outstanding, the requester will be stalled until one must be released.

  • It only grants permits at a limited rate, regardless of how many are outstanding. This means, after a permit is granted, no further permit will be granted until a fixed delay has elapsed.

Merge request reports