Skip to content

Commit

Permalink
Merge pull request #13 from SergeyMi37/master
Browse files Browse the repository at this point in the history
resolved #12
  • Loading branch information
evshvarov authored Jan 10, 2024
2 parents ed829a8 + 14216ab commit 713d2af
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/dc/cron/task.cls
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Class dc.cron.task
/// cron expression for schedule
/// runcode - a string with ObjectScript you want to be executed - it will be xecuted
/// tid - the taskid to be returned. You need it e.g. to suspend/resume or kill the task

ClassMethod Start(name, cron, runcode, runnow = 1, ByRef tid) As %Status
{
set sc = $$$OK
Expand All @@ -16,7 +15,6 @@ ClassMethod Start(name, cron, runcode, runnow = 1, ByRef tid) As %Status
/// * * * * * - run every minute
/// 0 * * * * - run every hour
/// 0 0 * * * - run every day at midnight

ClassMethod StartOld(cron, runcode, runnow = 1, ByRef tid) As %Status
{
set sc = $$$OK
Expand Down Expand Up @@ -82,7 +80,7 @@ ClassMethod StartByCronMakerExpression(name As %String, cronMakerExpression As %
Quit:key=""
Set $PROPERTY(task,key) = keyValue
}

Set taskdef = ##class(%SYS.Task.RunLegacyTask).%New()
Set task.TaskClass=$classname(taskdef)
set taskdef.ExecuteCode=runcode
Expand Down Expand Up @@ -122,7 +120,9 @@ ClassMethod ProcessCronMakerExpression(cronMakerExpression As %String, ByRef tas
Set taskProperties("DailyFrequency")=1
}
}

else {
Set taskProperties("StartDate") = $p($H,",",1)+1
}
If hours '= "*" {
Set everyXHours = $Piece(hours,"/",2)
If everyXHours '= "" {
Expand Down Expand Up @@ -151,6 +151,9 @@ ClassMethod ProcessCronMakerExpression(cronMakerExpression As %String, ByRef tas
}

}
else {
Set taskProperties("StartDate") = $p($H,",",1)+1
}

If month = "*" {

Expand Down Expand Up @@ -184,8 +187,8 @@ ClassMethod ProcessCronMakerExpression(cronMakerExpression As %String, ByRef tas
Set taskProperties("TimePeriodDay") = $Piece(dow,"#",2)_"^"_$LISTFIND(lstD,$Piece(dow,"#",1))
}
}

Quit $$$OK
Quit $$$OK
}

ClassMethod Kill(tid As %Integer) As %Status
Expand Down

0 comments on commit 713d2af

Please sign in to comment.