[keyserver] Debounce one-time key refresh request
Summary:
Identity will queue up a request for 5 new one-time keys every time it fails to find one. If a keyserver is offline for a bit, this can lead to a large queue of requests for one-time keys.
Instead of adding 5 new one-time keys for each message, I think we should debounce the requests. This diff makes us process just two requests (one leading and one trailing) if we see a large queue when we start up. From there, each additional message will be processed independently.
This addresses ENG-7383. More details there.
Depends on D11375
Test Plan: I enqueued 10 requests for new one-time keys, and then started the keyserver and observed that only 10 one-time keys were added to DynamoDB (meaning only two of the requests were processed)
Reviewers: kamil, tomek
Reviewed By: tomek
Differential Revision: https://phab.comm.dev/D11376