lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Switch to library for rate limit (fixes #5550, fixes #5548)

Open Nutomic opened this issue 7 months ago • 3 comments

The library looks quite good, it includes support for ipv6, rollback on error and standard headers like x-ratelimit-remaining (https://github.com/LemmyNet/lemmy/issues/5332). The tricky part is that it uses a lot of generics. Also there seems to be no way to change the limits at runtime. This means either adding that feature to the library, or removing the rate limit live update and possibly moving it from db to config (which makes sense to me).

Nutomic avatar Jun 02 '25 10:06 Nutomic

The live-updating is a must, based on experience of these needing to be tweaked by site admins.

Ideally that could be upstreamed, but if not, we could probably just recreate and replace the whole inmemorybackend object.

dessalines avatar Jun 02 '25 14:06 dessalines

The library should be updated to not use string keys.

dullbananas avatar Jun 02 '25 18:06 dullbananas

Both live updates and different key type should be possible by providing our own Backend and Input implementations, which can live in Lemmy code or be merged into the library. I made some changes in that direction but it gets pretty complicated.

Nutomic avatar Jun 03 '25 10:06 Nutomic

Live updates are working, and added support for live updates to the library (as well as some fixes). Here is the upstream PR.

Nutomic avatar Jun 18 '25 13:06 Nutomic

The upstream PR is not merged yet so this will probably require some further changes in another PR.

Nutomic avatar Jun 20 '25 07:06 Nutomic