24/7 Support: 800.608.6482

How To Guides

Try our new AI assistant by clicking the chat icon in the lower right corner.

How To Guides

Scheduled Tasks

In Miva 9.6 there is a new function called "Scheduled Tasks." From here you can schedule various tasks to run automatically in your store. Here's how it works:

Scheduled Tasks

Access Scheduled Tasks

Click on "Menu," scroll down to "Store Settings," click on the "Scheduled Tasks" tab. There is a default setting that comes with every 9.6 update and that's "Delete Expired Shopping Baskets." This new scheduled task will remove any items left in abandoned shopping carts once a day for you automatically.

Create A New Scheduled Task:

Click the "+" icon

Scheduled Tasks

A pop up window will appear. In this example we are going to run our Google Feed which we already set up earlier. If you'd like to see how to set one up for your store, [click here](http://docs.miva.com/v1.0/docs/how-to-create-a-google-sitemap-through-feeds).

Description:

Run Google Feed (or whatever feed you choose)

Operation:

Choose your task - we chose Standard Scheduled Tasks: Run a Feed

Add Scheduled Tasks

Schedule:

You have three options in the drop down menu.

  1. Minutes
  2. Hours
  3. Days

For this example, we chose to run our Google Feed once every 7 Days.

Next Run:

You can choose when you want to begin the run by changing the date/time.

Add Scheduled Tasks

Last Run:

Ours is blank now but once it starts running it will show you when the last run took place.

Feed:

To choose our Google Feed we need to click on the "Look Up" button.

Add Scheduled Tasks

Click on the Feed you want to run, for this example, "Google_Sitemap." Click ok.

Google Sitemap

Once all your settings are filled out correctly, click the "Save" button.

Google Sitemap

You will now see that you have a new Scheduled Task set up and ready to run.

Google Feed

There are two configurable setting for scheduled tasks located under Store Settings -> Settings

Store Settings

Store Settings

Spawn Scheduled Task Process:

This setting allows you to have Miva create a background thread which will sit and wait in the background until the task is set to run. By default this value is 0 seconds, which means this thread won’t be created until the task is ready to run. If you have a low traffic store or want to ensure your task will always run at the exact right time, you can adjust this value from 0 up to 864000 (24 hours). For example if you have this value set for 3600 (60 minutes) and a scheduled task is set to run in 58 minutes from now, Miva will start a background thread that will sit and wait until the time your task is set to run and execute the task and exit.

At most 1 background thread can be running at a single time. Tasks will continue to be added to a queue and will be processed by their order in the queue.

Recycle Schedule Tasks Process:

ach Scheduled Tasks Process has a one hour default timeout, but it may be lower depending on specific store configuration. Scheduled Tasks should be written in a manner where they track their progress and are able to resume from where they are interrupted, to ensure they are compatible with any timeout setting, as well as any external factor that may cause them to end before completion.

The Recycle Schedule Tasks Setting allows you to recycle or “reset” the timeout of the background process before it reaches its timeout when you have multiple tasks running back to back. This value can be 0 to 3600 seconds. For example if you have 2 feeds that each take 45 minutes to run, when the first one completes the next one will run, but there will only be 15 minutes left on the timeout for the scheduled task thread. Changing this setting will allow the timeout to get reset between tasks.

Miva Background Thread Timeout Setting:

By default this value is 60 minutes but it can be modified (reduced only) by an engine level setting. In Miva engines 5.24 or higher there is a new configuration parameter for:

asynctimeout

This will allow you to change the timeout shorter than 60 minutes, if desired.

Looking for Developer Docs?

We have a whole section for that, including: Developer Training Series, Template Language docs, Module Development tutorials and much, much more.

Head to the Developer Section

Copyright © 1997 – 2024 Miva®, Miva Merchant®, MivaPay®, MivaCon®, Camp Miva®, Miva Connect®, Miva, Inc. All Rights Reserved.