Page 1 of 1

Long Running Process with Scheduled Plugin

PostPosted: Tue Jun 16, 2020 11:41 am
by SBarnes
Is there any to have the scheduled plugin service cancel a process if it goes past a given period of time whilst running so it doesn't hold up any other schedules or does the scheduler handle handle multiple task simultaneously so a plugin can't "stall" things?

Re: Long Running Process with Scheduled Plugin

PostPosted: Tue Jun 16, 2020 1:18 pm
by Mike.Sheen
SBarnes wrote:Is there any to have the scheduled plugin service cancel a process if it goes past a given period of time whilst running so it doesn't hold up any other schedules or does the scheduler handle handle multiple task simultaneously so a plugin can't "stall" things?


No - and I don't think it would be possible to hack in by spawning off a task in the Execute method and handling it that way without introducing some interesting problems.

We'd be best to add a property you could set from within the plugin itself to add a timeout value - perhaps a TimeSpan - and when not null we could invoke an optional method of the plugin to indicate timeout expired and the plugin could abort in a safe fashion - I don't think we'd forcibly kill a scheduled plugin task upon timeout ourselves.

Re: Long Running Process with Scheduled Plugin

PostPosted: Tue Jun 16, 2020 1:21 pm
by SBarnes
Ok thanks,

I think a separate version of the service is likely to be the safest option.