Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-1681

Handle dynamic rate limit

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 2.2.3
    • None

      Some servers return rate limit information in the server headers (Apiseeds does this now, but also MB services do it).

      If should adapt our rate limiting code to adapt to this and respect the limiting reported by the service. There are some variations in this, though.

      MB reports the rate limit like:

      x-ratelimit-limit: 1200
      x-ratelimit-remaining: 853
      x-ratelimit-reset: 1575128422

      Apiseed will respond with something like:

      x-ratelimit-limit: 100
      x-ratelimit-remaining: 0
      x-retry-after: 60

      The have a limit of 100 requests, once those are exhausted x-ratelimit-remaining will be 0 and x-retry-after gives a wait time in seconds.

      For an implementation handling the MB rate limit see https://github.com/phw/rhythmbox-plugin-listenbrainz/blob/master/listenbrainz/client.py#L150

      I think we could incorporate this in the existing rate limiting code.

            Unassigned Unassigned
            outsidecontext Philipp Wolfer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Version Package