feat: Add Recipe poll interval configuration
Pre-flight Checklist
Please ensure you've completed all of the following.
- [x] I have read the Contributing Guidelines for this project.
- [x] I agree to follow the Code of Conduct that this project adheres to.
Description of Change
Added the ability to change the interval which every recipe's poll function is triggered
Motivation and Context
On Ferdium there is an hardcoded poll interval (2s) and for some recipe are useful to give the ability to change this interval to respect and not abuse the api rate. In addition this configuration allow the reducing of the energy/resources used to run the recipe itself if the timing are correctly setted up respect of the default 2s. For compatibility if no time configuration are passed or if the time interval is less the 2s, the default value remain 2s. To configure the poll the formalism is based on the ms npm packages
Examples:
/*Classic usage*/
...
Ferdium.loop(checkTickets); // it will use the default 2s poll interval
/*With configurable poll interval*/
...
let interval = '60s'; // can be also '1m' to specify 1 minute
Ferdium.loop(checkTickets, interval); // it will use the 60s poll interval
Checklist
- [x] My pull request is properly named
- [x] The changes respect the code style of the project (
pnpm prepare-code) - [x]
pnpm testpasses - [x] I tested/previewed my changes locally
Release Notes
none
Hi! @Alphrag, thanks for you observations, I appreciate that. I agree with you, to make this modification, so I will edit the code to insert this observations and after I will repropose a new merge request. Thanks!
Perfect, I look forward to it. As long as you modify the code on your branch, the PR will update itself, so it won't be necessary to create a new one. So once you have done all the modifications in your branch (and rebased on those that are on the ferdium-app/develop one), simply ping me here and I'll review again. It is better to avoid closing and reopening new PRs for the same thing to keep the flow of reviews in the same place 😉
Hi @Alphrag ! I made the changes we talked about Thanks