More Than 20 Scheduled Jobs ?

I already read this https://support.wix.com/en/article/velo-scheduling-recurring-jobs

Can I create more than 20 jobs because 20 is not enough for me. I want to run scheduled jobs but Wix limited it with 20 I could not install npm packs about this because it’s not available. Anyway anyone knows something about how to create more jobs than 20.

Hi,
The current limit is 20, but there may be a workaround. One of our product managers will reply here with more information. Thanks!

Hi,
How many jobs would you want to define?

Please let me know if that solves the issue.
Thanks!

Can you share an example code because I could not understand what should I do.

For example this config:

{
  "jobs": [
    {
      "functionLocation": "/my-file.js",
      "functionName": "myFunc",
      "executionConfig": {
        "cronExpression": "0 1,2,3 * * *"
      }
    }
  ]
}

it will run the function myFunc() inside backend/my-file.js file three times
At 01:00 AM, 02:00 AM and 03:00 AM

You can use this app: Jobs Config | Velo by Wix

Note: You can schedule your job to run at intervals as short as one hour apart, but not shorter. If you define your job to run more frequently, the job will be ignored.

Syntax

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

This is a more advanced solution but just putting it out there in case it helps someone (use Aviv and Alexander’s solution if you’re a beginner)

I had this issue where I needed to run a function every minute. Found 2 solutions, one is within Wix and the other is external.

Wix: One solution I found is to create an endpoint on my primary site which calls my desired function. You could also call a different function based on the time of the day if you want further segmentation:

const decideWhich = () => {
   let date = new Date(); //time is in utc so plan accordingly
   let hour = date.getHours();
   let minutes = date.getMinutes();
   if(hour === 23) {
     resettingStock();
   } else {
     startUpdate();
   }
}

Now each site can only have a maximum of 20 jobs but you can also run jobs on free wix sites so create another wix site and use the 20 jobs to call the HTTP endpoint on your primary site using fetch. That would give you a total of 40 jobs now.

A total of 2 additional free wix sites (20 + 20 + 20) would allow you to run a job each minute now. Now remember that there might be a second or two delay in executing the function due to it being called via fetch (network congestion)

External: More simple for me was to host a nodejs web app on aws or firebase and call the endpoint on the primary wix site using the cron npm.

It really depends on what you are trying to do and how clean and quick (down to the millisecond) you require your function to execute but the 1st option should be easier.

Should I use npm pack for this called as “Bree” I can install it and use it. If it’s better to do.

Also as I know Backend codes already work everytime if I use this npm in my normal backend code will it run in every hour and can I create more than 20 jobs?

I also need more then 20 scheduled jobs because I am making a website that automatically updates collections with products every day. I have already paid a deveoper to make code that gets the data from the api endpoint to the collection. I need some help to learn how to use an npm to schedule jobs. here is my forum post https://www.wix.com/velo/forum/coding-with-velo/schedule-more-then-20-jobs-to-update-collections-everyday