Switch to library for rate limit (fixes #5550, fixes #5548)
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).
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.
The library should be updated to not use string keys.
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.
Live updates are working, and added support for live updates to the library (as well as some fixes). Here is the upstream PR.
The upstream PR is not merged yet so this will probably require some further changes in another PR.