Northeastern-Electric-Racing / Argos

Our full-stack data visualization tool
GNU Affero General Public License v3.0
1 stars 0 forks source link

[Scylla] - Implement basic static rate limiting #183

Closed jr1221 closed 2 months ago

jr1221 commented 2 months ago

Description

Scylla JS has rate limiting. Turns out we need it for rust as well. It basically involves discarding any message that is sent within 100 ms (by default) of the last message per topic name.

Acceptance Criteria

Proposed Solution

At the db handler layer introduce a HashMap<String, DateTime> or something which stores the time the last message came in. Do this only for messages that are not considered special types (i.e. messages we plan to batch insert). If the difference in time of a new message is smaller than the 100ms or whatever setting, discard the message and bail out of the processor. If it is greater store the new time in the hashmap and continue processing the data.

Mocks

No response

jr1221 commented 2 months ago

@RChandler234 Do you want this to wait until after rust is merged or add it to #171 ?

RChandler234 commented 2 months ago

I will look at the rust PR tn, and then you can merge it whenever you're cool with it, and then do this separate

RChandler234 commented 2 months ago

@jr1221