UMAprotocol / protocol

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

fix: use redis log queue for discord tickets #4746

Closed Reinis-FRP closed 2 months ago

Reinis-FRP commented 2 months ago

Motivation

Discord Ticket Tool transport can fail to log all messages within a serverless call if this exceeds rate limit of 15 logs per second.

Summary

Introduces persistent log queue management for Discord Ticket transport. Any rate limited logs would be resumed on the next run cycle.

Details

This reworks initial solution in #4734 to use Redis instead of Datastore as it had 1500 character limit. This PR creates an abstract base PersistentTransport base class that saves all logged messages to Redis. It has separate logic to process all messages upon logger creation or whenever new messages is logged by via the derived transport. The log queue processing method gets the oldest stored message with matching bot identifier that should be delivered by the derived transport respecting any of its rate limits. Processing of log queue continues till the queue is empty or the transport receives pause signal from logger as invoked before process termination.

Note that this can be merged only after the required Redis server is attached to the runtime environment.

Testing

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

Issue(s)

Fixes https://linear.app/uma/issue/UMA-2368/verification-bot-bug

linear[bot] commented 2 months ago

UMA-2368 Verification Bot Bug