Scheduled task cache

Wei Wang asked on November 17, 2020 21:50

Hi, I wonder is there any cache in the scheduled tasks? I don't know why sometimes when running a scheduled task with some custom settings it won't take any changes I made in the custom settings.

Correct Answer

Juraj Ondrus answered on November 19, 2020 09:48

Thanks for the details. Are those settings global or site level settings? Based on the code you are checking the global settings - so, you need to change those. Otherwise I do not see any reason why the new values should not be applied when the code is executed.

0 votesVote for this answer Unmark Correct answer

Recent Answers


vasu yerramsetti answered on November 18, 2020 06:52 (last edited on November 18, 2020 06:54)

There no cache for the scheduled tasks. Is it custom Or default scheduled task?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 18, 2020 09:22

How are you making changes in the custom settings? Through the UI?

0 votesVote for this answer Mark as a Correct answer

Wei Wang answered on November 18, 2020 14:06

Yes, through UI. It's a custom task to import products.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 18, 2020 14:17

If it is through the UI, then the application should be aware of the changes. And the code of the scheduled task is accessing the values directly anyway. I would need to know some steps and maybe code snippet in order to reproduce the issue reliably.

0 votesVote for this answer Mark as a Correct answer

Wei Wang answered on November 18, 2020 15:10

Looks like the initialization of the parameters part of the code execute only the first time I run the task. When I run the task again it just skip the initialization part. So I made a change in the settings it won't take effect.

Initialization code:

[assembly: RegisterCustomClass("CMPTask.YellowDogUpdate", typeof(CMPTask.YellowDogUpdate))] namespace CMPTask { /// public class YellowDogUpdate : ITask { private static bool isTestMode = ValidationHelper.GetBoolean(SettingsKeyInfoProvider.GetValue("YDSandbox"), false); private static string baseURL = (isTestMode) ? ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDBaseURLSandbox"), "") : ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDBaseURL"), ""); public static string username = (isTestMode) ? ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDUserNameSandbox"), "") : ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDUserName"), ""); public static string password = (isTestMode) ? ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDPassowrdSandbox"), "") : ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDPassowrd"), ""); public static string clientID = (isTestMode) ? ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDClientIDSandbox"), "") : ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("YDClientID"), ""); public static string webStoreID = ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("WebStoreID"), string.Empty);

0 votesVote for this answer Mark as a Correct answer

Wei Wang answered on November 19, 2020 14:01

thanks!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.