Corvid Scheduler

Hello! I am trying to use the Corvid scheduler for a very simple feature, and it doesn’t seem to be working correctly at all. Wondering if I could get some help here.
Feature: change the date in the footer every day at noon “Site last updated: May 4, 2019”

Here is the code to the scheduler (in jobs.config):

{
  "jobs": [
    {
      "functionLocation": "backend/mls.updateTime",
      "description": "Update Time of site",
      "executionConfig": {
        "time": "12:00", // mandatory, “hh:mm” format
      }
    },
  ]
}

The function mls.updateTime is right here:

export function updateTime() {
 const date = new Date();
 let toInsert = {
 "siteUpdate": date,
 "_id": "fa8963a3-9183-4fad-a7fb-7e21e0882c8d",
    }

    wixData.update("GlobalVars", toInsert)
        .then((results) => {
 let item = results; //see item below
        })
        .catch((err) => {
 let errorMsg = err;
        });
}

Here is the directory setup (that way you know I’m doing this correctly. And the _id for the data is so I’m always pulling the correct date and inserting the correct date in a SINGLE row - not creating new ones.

So every 24 hrs, the date in the live database GlobalVars (the _id corresponds to the live database by the way, I’ve already made sure it’s not corresponding to the sandbox) should be updated. Now in “Site Code” section of the site, we are inserting that date into the footer like so: this is within the $w.onReady() function by the way, and #updated is the text in the footer that should contain the date. Nothing is working

wixData.get("GlobalVars", "fa8963a3-9183-4fad-a7fb-7e21e0882c8d")
        .then((results) => {
 let item = results; //see item below
            console.log(item)
            $w("#updated").text = item.siteUpate.toLocaleDateString()
        })
        .catch((err) => {
 let errorMsg = err;
        });

hi Ben,

I think the issue is with: “functionLocation”: “backend/mls.updateTime” ,
The backend is not required.
Also the commas prevents the scheduler from working as it expect a standard json input.
If there is an issue with the relevant docs we shall fix them.
I’m adding an example for a function and jobs.config that works for me:


If you’re still experiencing issue please add the URL for the site.
Let me know.

Hi Uriya, here is the URL Ben is talking about. We appreciate your help!

@josev

The correct format for the jobs.config for your site should be:

Notice that I’ve added a “/” before mls and removed the “,”.
Also once this is fixed take care of the function that updates the footer date, as it has a typo error: “siteUpate” should be “siteUpdate”.

Cheers.

@uriyaa Hi Uriya,

Thanks for your help. I made the changes you said (looks like you went in and actually already made a number of them).

Unfortunately, the scheduler is still not running at all and nothing changes. Can you please take another look at this and see what is going on? I think the scheduler feature is just not working.

@bens hi John, can you elaborate on what’s not working? For me when I test your code I see that the date at the footer is being updated as it should be.

@uriyaa Looks like it’s working now. I think the time for the scheduler is just on a different time zone that I thought. Do you know what time zone the scheduler runs on - that will be helpful for future purposes. Thanks!

@bens hi John, the time zone is UTC, as mentioned in the docs: “The time of day the job runs. The time is specified as UTC time .” :slight_smile: