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.
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.
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.
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