ferdium-app icon indicating copy to clipboard operation
ferdium-app copied to clipboard

feat: Add Recipe poll interval configuration

Open faraoman opened this issue 2 months ago • 3 comments

Pre-flight Checklist

Please ensure you've completed all of the following.

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 test passes
  • [x] I tested/previewed my changes locally

Release Notes

none

faraoman avatar Oct 08 '25 18:10 faraoman

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!

faraoman avatar Oct 12 '25 17:10 faraoman

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 😉

Alphrag avatar Oct 12 '25 17:10 Alphrag

Hi @Alphrag ! I made the changes we talked about Thanks

faraoman avatar Oct 18 '25 14:10 faraoman