Developer forum

Forum » Development » ScheduledTask Execution Timeout

ScheduledTask Execution Timeout

Anders Ditlevsen
Anders Ditlevsen
Reply

Hi Dynamicweb

In the newer dynamicweb versions i am having difficulties with completing scheduled tasks that runs for longer than 1 hour.

When i delve into the code of the runner, i stumble upon a hardcoded value of one hour, which aligns with my problem of my tasks getting thread aborted after what seems to always be exactly one hour.

I've attempted to override this with a web.config with an increased executionTimeout in the folder where the task runner aspx is located however it has not worked.

How can i override this hard coded time, as i need the task to run for longer?

image.png

Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Anders,

What type of scheduled task is this and what is it doing?

No scheduled task should have to run for more than an hour. That is extremely long time for executing anything in a web application. I think you should consider optimizing the task or run it on the server instead.

You can create a notification subscriber for Dynamicweb.Scheduling.Notifications.ScheduledTaskNotifications.OnScheduledTaskStart and then set HttpContext.Current.Server.ScriptTimeout to whatever you want. However, I would not recommend doing that.

Best regards,
Morten

Votes for this answer: 1
 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Anders

Seems like that timeout was added because the default timeout in web.config caused problems - now leaving another issue. It was introduce in september 2017, and it probably should not have been introduced.

I've changed the code to this:

If Server.ScriptTimeout < 3600 Then
      Server.ScriptTimeout = 3600
End If

So if your value in web.config is higher than 3600 seconds, it will not be overriden.

TFS#59376, merged to 9.5 so far - ready for next hotfix of that branch and for 9.6 later this month.

BR Nicolai

Votes for this answer: 1
 
Anders Ditlevsen
Anders Ditlevsen
Reply

Hi Morten

You are correct that it is quite a long time. However this solution has some very complex integrations running where it integrates things such as products, variant groups, variant groups options, variant combinations, customfields and category fields and values with different individual values for both mother and child products, groups, relations, creating new fields in dw (for each language). We also use part of the dynamicweb api for doing this, so running this through dynamicweb is needed.

Thanks for the work around idea. I wish only to increase the timeout for scheduled tasks or specific scheduled tasks.

Thanks for the response Nicolai. Great to know that its changed in the future so we have the option to increase it, incase its really needed.

I understand tasks generally shouldnt run so long, however its not a problem we run into often.

 

You must be logged in to post in the forum