Skip to content

Commit

Permalink
Add random delay to avoid stacking of tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
patrix87 committed Nov 4, 2021
1 parent 2a5f34e commit 53466bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion functions/util/Register-UpdateTask.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function Register-UpdateTask {
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "-WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File $scriptpath -ServerCfg `"$ServerCfg`" -UpdateCheck" -WorkingDirectory $dir
$trigger = New-ScheduledTaskTrigger -Daily -At 12am
$trigger = New-ScheduledTaskTrigger -Daily -At 12am -RandomDelay (New-TimeSpan -Minutes $Global.UpdateCheckFrequency)
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 10)
$description = "Check if updates are available for $($server.Name)"
$title = "UpdateCheck-$($server.Name)"
Expand Down

0 comments on commit 53466bd

Please sign in to comment.