Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Critical: Task runner is not working right

Critical: Task runner is not working right

Anders Ebdrup
Anders Ebdrup
Reply

Hi DW,

 

We see in DW9 that the task runner is not right according to next executing time, and it is quite a big problem for us as we cannot be sure when a task is executed and we have tasks which is dependent on other tasks.

 

I think the problem is related to this code block in task.vb:

    Private Sub UpdateNextRun()
        Dim now As Date = Date.Now
        now = now.AddMilliseconds(-now.Millisecond)
        now = now.AddSeconds(-now.Second)
        now = now.AddMinutes(1)
        now = now.AddMinutes(-now.Minute Mod 5)
        UpcomingRuntime = now

        If UpcomingRuntime > [End] Then
            UpcomingRuntime = Consts.MinDate
        Else
            If UpcomingRuntime < Begin Then
                UpcomingRuntime = Begin
            End If
            'Minute = Number of minutes between each run
            If Minute > 0 Then
                If StartFromLastRun Then
                    Dim ts As TimeSpan = TimeSpan.FromTicks(UpcomingRuntime.Ticks - Begin.Ticks)
                    UpcomingRuntime = UpcomingRuntime.AddMinutes(Minute - (CType(ts.TotalMinutes, ULong) Mod Minute))
                Else
                    UpcomingRuntime = New Date(now.Year, now.Month, now.Day,
                                               If(now.Hour > 0, now.Hour - 1, 0),
                                               If(Begin.Minute > 0, Begin.Minute, 0), 0)
                    'Add minutes until we are in the future
                    Do While UpcomingRuntime < now
                        UpcomingRuntime = UpcomingRuntime.AddMinutes(Minute)
                    Loop
                End If
            Else
                UpcomingRuntime = Consts.MinDate
            End If
        End If
    End Sub

 

I really hope that this can be fixed in the next hotfix? Please see this screenshot: https://www.screencast.com/t/k4scM0pktTqn

 

 

Best regards, Anders


Replies

 
Nicolai Pedersen
Reply

Can you check if the new checkbox, "Set next run time based on end time" is doing what you want?

Thanks, Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

It does not, as I need the jobs to be executed at the same time every day and not be moved one hour earlier, due to this: If(now.Hour > 0, now.Hour - 1, 0), and if I use the new checkbox then the starting time will be pushed forward every day with the time of the execution time.

 

Best regards, Anders

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Anders,
it looks like you need to use the "Set next run time based on end time" option as it means that your scheduled tasks will run exactly from the start date.

According to your image I was trying to reproduce it for the first task from your screen configured the start date at 01:45 and checked the
"Set next run time based on end time" - task next run was calculated from the starting point and showed me 01:45 next day which is OK.
However when I was setting this task without the checkbox enabled
and started this task at 00:45 the task next run was calculated to 00:45 next day (as it adds the ticks from the current task execution time not from the task start time),
when starting the task at 01:25 the task next run was calculated to 00:45 next day - which is wrong and should be 01:45

Looks like a bug, TFS# 49964 created
Regards, Dmitrij

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Dmitrij,

 

I hope that you can have this ready for the tuesday release?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Anders,
yes, should be

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Anders

The problem regarding #49964 "Scheduled task next run time is calculated wrong" has now been resolved in Dynamicweb version 9.4.11

To upgrade please choose this version from backend or download from here:

http://doc.dynamicweb.com/releases-and-downloads/releases

Let me know if you need any more help regarding this

Kind Regards
Dynamicweb Support
Kristian Kirkholt

Votes for this answer: 1

 

You must be logged in to post in the forum