HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Scheduled jobs

Describes scheduled jobs in Optimizely Commerce Connect 13.

Scheduled jobs run in the background at preset time intervals and typically do cleanup and batch updating tasks.

A default Optimizely Commerce Connect installation has several predefined scheduled jobs, which are managed from the Optimizely Content Management System (CMS) administration interface.

796

You can also add custom scheduled jobs, see Scheduled jobs in the CMS Developer Guide.

Classes for scheduled jobs are available in the following namespaces:

  • EPiServer.Business.Commerce.ScheduledJobs
  • ScheduledJob and ScheduledJobCollection classes of the EPiServer.DataAbstraction namespace in Optimizely CMS.

Default scheduled jobs

A sample installation of Commerce Connect contains the predefined scheduled jobs as described in the following.

Remove expired carts

Removes expired carts, meaning they have not been accessed for a specified number of days. The default value is 30. This can be configured in the ExpiredCartJobDays property of the appSettings file.

You can also control the name of carts to be excluded from removal via the appSetting key episerver:ExpiredCartsRemovalJobExcludedCartName. The default value is "Wishlist".

Full search index

Performs a full indexing of content in product catalogs.

Incremental search index

Performs an incremental indexing of content in product catalogs.

Draft store migration

Used for migration of previously published content versions, when upgrading to the version management introduced with Commerce Connect 9. See Commerce Connect 9 - upgrading and migration.

Find catalog URI conflicts

Analyzes the database to find entries and categories that have the same Name in URL under the same parent category. If conflicts are found, they are logged as warnings, output to the Scheduled Job Log, and sent to email addresses specified in the episerver:commerce.UriSegmentConflictsEmailRecipients AppSetting. For details, see URL segment and SEO URL.

Shipment releasing

Searches for releasable shipments in active orders. If the difference between the shipment creation time and the current time is greater than the configured time span, the shipment status for the order is changed to Released.

By default, when the job is activated, order shipments are released _one hour_after an order is placed. The value can be changed changed from appsettings.json file by setting the shipmentAutoReleaseTimeout property value.

Rotate encryption keys

Sensitive customer data is secured with encryption keys that are set in meta-fields. This job rotates the encryption keys used by the system.

Maintain database indexes

This job rebuilds or reorganizes database indexes, to reduce fragmentation in the CMS and Commerce Connect databases. When the job is launched (manually or automatically), it rebuilds or reorganizes depending on the current fragmentation percentage.

You can run the job manually any time you notice a degradation in performance. Or, you can schedule it to run at regular intervals. If possible, the job should be run at times of low usage. You can also set the following parameters to launch the job automatically, when specified fragmentation levels are met.

ParameterDescriptionDefault valueChanging the default value
HighFragmentationThresholdIf the avg_fragmentation_in_percent of an index is larger than this value, the index is rebuilt.30%Add a setting to the commerce section of appsettings.json file using the key episerver::HighFragmentationThreshold.
LowFragmentationThresholdIf the avg_fragmentation_in_percent of an index is larger than this value, and smaller than or equal to the  HighFragmentationThreshold value, the index is reorganized.10%Add a setting to the commerce section of appsettings.json file using the key  episerver::LowFragmentationThreshold.
DataBaseIndicesJobCommandTimeOutThe maximum number of seconds for which you want the job to run. If the job does not finish within that time, an exception is generated.30 secondsAdd a setting to the commerce section of appsettings.json file using the key episerver::DataBaseIndicesJobCommandTimeOut. Within this appsetting setting, set the value to the maximum number of seconds for which you want the job to run.

Collect subscription data for reports

This job collects subscription data, ensuring that recurring payments are regularly generated as a background process. This data is used for payment plans, such as magazine or grocery subscriptions.

Collect order data for reports

This job compiles the data used in the Sales By Day report.

Collect orders per promotion statistics

This job reworks the collection of promotion (discounts) statistics for orders associated with campaigns in the Marketing view in Commerce Connect.

This view displays discounts for an order, the number of orders that use each discount, and the total number of orders that include discounts. The calculation rework is done to improve performance for the display of these statistics.

Run the Collect orders per promotion statistics job to migrate your promotions system to use the new optimization. If campaigns have too many orders, you may get a timeout exception when running the job. If you do, add the appSettings key episerver:commerce.OrderPerPromotionReportDataTimeout, and set the timeout in seconds.

By default, this optimization ignores inactive and expired campaigns and promotions, although they are migrated along with active campaigns and promotions. If you want to force the refreshing of their data, add the appSettings key episerver:commerce.ReportForInactivePromotionItems and set it to "true".

Other scheduled jobs

These jobs are available if you have Optimizely Product Recommendations, Optimizely Campaign, or the Optimizely Service API in your implementation.

Export product feed

Exports the _entire_product feed (catalog) for the Product Recommendations, to provide updated information to the recommendation service. This job includes all changes, including deletion of products and edits to asset and inventory information.

Export product feed incrementally

Exports the product feed (catalog) incrementally to Product Recommendations. This job updates product changes without exporting the entire catalog.

This job is faster than the full product feed export job, since changes only include added and updated products. However, the incremental export job does not replace the full export job, since deletion of products and edits to asset and inventory information are not included.

Export product data to Optimizely Campaign

This job collects product data and saves it to a .csv file for data transfer to Optimizely Campaign. See Commerce Connect-Campaign integration.

Remove old Service API uploaded files and directories

The Optimizely Service API is used for importing large files such as commerce catalogs. The Service API provides a method for deleting uploaded files that are no longer needed. You can use this scheduled job to clean up obsolete files in case the Delete chunk uploaded method is overlooked.

The job, which is only available after installing the Service API, removes temporary uploaded files and directories older than several configured days. The value can be set in the appsettings.json commerce section, using episerver:serviceapi:uploadRetentionPeriod. The default is 30 daysif there is no configuration value.