sapphiredev / utilities

Common JavaScript utilities for your TypeScript projects
https://www.sapphirejs.dev/
MIT License
157 stars 39 forks source link

request(ratelimits): data export/inport support #719

Open JuanPablo2655 opened 9 months ago

JuanPablo2655 commented 9 months ago

Is there an existing issue or pull request for this?

Feature description

I want to export ratelimit data and save them in a database when my application goes offline and have the ability to import it back once the application comes back online.

Desired solution

For rateLimitManager to have an export and import function.

Alternatives considered

I haven't concidered any other alternatives because the sapphire framework has cooldowns already built-in that use this library.

Additional context

No response

favna commented 9 months ago

I'm down for adding this feature but running timers are not serializable, they use setInterval https://github.com/sapphiredev/utilities/blob/b8a7f1abc6ba3c676cd0de716e99e1e0b3b5a4a4/packages/ratelimits/src/lib/RateLimitManager.ts#L53-L56

I have no idea how this can be realised.