Invoking Web Module code from the job scheduler, are WebMethod requests still limited to 14 seconds?
Hi, @smccfly ,
Can you please share your jobs config and functions, I’ll be able see what the issue is?
Hi @brainstorrrm
The good new that there is no 14 secs limitation when invoking scheduled tasks. However, the jobs functions are still short living functions…
In the future we are planning to release long execution jobs feature as well
Hi @andreasbnor ,
The good new that there is no 14 secs limitation when invoking scheduled tasks. However, the jobs functions are still short living functions…
In the future we are planning to release long execution jobs feature as well
Thanks, @dmitry-batkilin ! Is there, or will there be a way to debug scheduled jobs using breakpoints? I have a recurring job that seemingly doesn’t work in Wix, but works in a local Node environment, so I need some way to debug other than console logs (when I invoke the job’s code via a page’s code).
#ignored ![]()
@shlomi-shemesh
@felipe-bustos can you please share the url of your site?
Hi @felipe-bustos ,
i couldn’t find jobs configured at your site at all, please open a new forum post with a simple new site, so you can publish frequently for testing. try to configure a simple job, and please mention me on that thread so i can have a look at your code
thanks,
Shlomi
@shlomi-shemesh
Think pages with sensitive information that should logout a user if idle or if the browser was closed without logging out from the site (airline, banking, etc.)
When a user clicks on some buttons I can save a timestamp (or pulse) in the database.
With simple code and timer I can handle a popup that says “are you still active?” and then proceed accordingly.
However, if a user closes the browser (without logging out), the next time you open the browser and select the corvid/wix page, the page opens up and shows the user is still logged in.
Currently, I see no chance to logout the user automatically.
With the scheduler, perhaps I could check at certain intervals the timestamps (pulses) of a block of users and logout any that have not been active for X amount of time.
Sounds feasible, but wanted pro feedback before I start coding and testing.
An api for this would be very useful.
@andreasbnor
Currently there is no debug capabilities other then logging your code…
you can use either our new telemetry features or as you mentioned - invoke code via a page’s code )
find out more about telemetry in the link below
https://www.wix.com/corvid/feature/App-Monitoring
BR,
Dima
Hi Guys
I was wondering if anyone could help out - I’m struggling to wrap my head round this one!
I’m wanting to have a reoccurring code run every morning (any time, just needs to be daily) to check my database to see if the end date of a post has expired in one of my fields. If so, delete the ‘end date’ from the field (not the post - just the date in the field).
The database is called: “posts”
The field is called: “ends”
Is this feasible using job scheduler?
Many thanks in advance!
T.A
Hi Thomas,
Sounds like a perfect case for a job scheduler - just write a backend function that do desired job(changing the db field) and configure schedule for it in jobs.config file.
Best,
Dima
@thomas.anthony
This looks very complex but it’s actually quite simple. Think of the jobScheduler as a trigger, like a button would work. That’s all it is. So the first step would be to create the backend file and write your function in there, something like this: (Oh yes, before you do this set up your file like I have here. Create a backend folder name ‘utilities’ and then under this create a .js file called ‘cleanDB’ - these are all just names I made up by the way but we need to reference it in the code)

Then in your ‘cleanDB’ folder add the following code:
export function removeEndDate() {
let today = new Date();
wixData.query("posts")
.lt("ends", today)
.find()
.then((results) => {
if (results.items.length > 0) {
let items = results.items;
//loop through all the items and update the relevant ones
items.forEach(item => {
item.ends = undefined;
wixData.update("posts", item)
});
}
})
.catch((err) => {
let errorMsg = err;
});
}
Then lastly set up your trigger in the jobScheduler backend file like so:
{
"jobs": [{
"functionLocation": "/utilities/cleanDB.removeEndDate",
"description": "Remove expired end dates",
"executionConfig": {
"time": "15:31" //time is UCT time - allow 5 min's for function to run
}
}]
}
Note in the above file the file location defined as “functionLocation” = “/utilities” is my folder, then “cleanDB” is my .js file and “removeEndDate” is my function name.
That’s it! This should work if you just drop it in.
Good luck!
Tiaan
@tiaan Excellent!
Thanks a lot. Seems pretty logical now I’m reading it
I’ll just swap out ‘today’ for a ‘today - 1’ and I should be good to go for expired posts.
I’ll have a play around when I get home.
Many thanks again! You just saved me a lot of headaches trying to figure this out.
Cheers!
Hi @tiaan
I can’t quite seem to get the code to trigger in the job function.
The code itself works perfectly (I tested it in the onReadyof my home page). Not sure what I’m missing?
It’s not the end of the world as providing there is traffic, it will check and clear the old posts!
Cheers ![]()
Hi Anthony
Then it sounds like a bug with the trigger in the jobs config file. Can you post a screenshot of your backend file locations as well as the jobs config code?
Thanks
Tiaan
@tiaan for the time field, what should be the time zone ?
Hey guys,
What are the duration limitations for the job scheduler functions? Can it run loop through a database of 100 items performing query and email triggers for each if necessary?
I have a chat system and I want to send out email notifications to people who did not ‘SEE’ the last message sent to them. In the database field ‘status’ if the value is ‘UNSEEN’ then I would like to trigger an email.
Its good for about 10-15 chats but what about more than 100? Can it fulfill all of them?
Shan
If I want a job to run several timer a day can I add the times into 1 job or do I need to create another job object for each time I want the job to run. e.g
{
"jobs": [
{
// first job object
"functionLocation": "/utils/dbUtils.deleteExpired",
"description": "Delete expired DB items",
"executionConfig": {
"time": "22:00",
"time": "23.00"
}
}, {
// another job object
}
]
}