akshaysura / Sitecron

SiteCron is a scheduling module based on Quartz Job Scheduler.
MIT License
22 stars 23 forks source link

SiteCron jobs stop being scheduled #34

Open adamizbekia opened 2 years ago

adamizbekia commented 2 years ago

We have been experiencing an issue with Sitecore 9.3 and SiteCron 3.2.0. We have noticed that sometimes after a job was run, all of our jobs stopped being scheduled.

What we have found out is that the issue is caused by some of our jobs changing the context language. This somehow causes the Stats fields being saved into a language version which does not exists.

And we think in that case the item saved handler will run because of the creation of the new language version and as the item changes won't contain Stats changes, it will reload the jobs while the context language is still changed. This will mean that no jobs will be loaded as even if a job has a version in that language, the Type and CRON Expression fields of the version are empty.

A restart of the site always solves the problem because during initialization the jobs load in en language.

We've discovered that making jobs fields shared mitigates the issue, but we would like to ask for opinions on this matter. What do you think would be the best way to tackle this?

Any help is much appreciated.

adamizbekia commented 2 years ago

We were able to replicate the same with a simple job containing a SiteContextSwitcher and a Language Switcher: LanguageTestJob.zip

asontu commented 1 year ago

You could try my SiteCron fork where the fields are Shared.