UMAprotocol / protocol

UMA Protocol Running on Ethereum
https://uma.xyz
GNU Affero General Public License v3.0
359 stars 174 forks source link

fix: pause persistent log queue after flush timeout #4751

Closed Reinis-FRP closed 2 months ago

Reinis-FRP commented 2 months ago

Motivation

Discord verification team reported that Optimistic Oracle bots are rate limited to 1 ticket per every serverless run cycle of 5 minutes. This is a bug that should be fixed.

Summary

Fixes Discord Ticket logger bug to allow submit max tickets as permitted by intended rate limit (1 ticket per 15 seconds).

Details

The bug is fixed by moving signal to pause persistent log queue transports only after waiting for logger flush timeout (we use 5 minutes for Oracle bots). In order to gracefully handle log delivery once this timeout passes this fix also changes pauseProcessing method to async and waits for processed event emitted from processLogQueue when it gets out of while (this.canProcess) loop.

Testing

Check a box to describe how you tested these changes and list the steps for reviewers to test.

Issue(s)

Fixes #XXXX