Skip to content

Commit 2284503

Browse files
committed
(MAINT) Increase timeout interval
The wait parameter in the start_sql_agent_job depends on a sleep interval that waits long enough for the agent to spool up a job and get it running. In testing it appears that some agent jobs are not spinning up fast enough, causing the wait parameter to have no effect. This change increased the timeout so that the wait parameter has time to see the job starting to execute and then wait for it to complete.
1 parent 882947a commit 2284503

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tasks/start_sql_agent_job.ps1

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ foreach ($instance in $SQLInstances) {
8181
$selectedJob.start($jobName)
8282
# It takes the server a little time to spin up the job. If we don't do this here
8383
# then the -wait parameter may not work later.
84-
Start-Sleep -Milliseconds 300
84+
Start-Sleep -Seconds 1
8585
}
8686
}
8787
}
@@ -96,6 +96,7 @@ do {
9696
}
9797
[void]$finishedJobs.add((New-CustomJobObject -job $job))
9898
}
99+
Start-Sleep -Milliseconds 300
99100
} while ($wait -and !$done)
100101

101102
$return.jobs = $finishedJobs

0 commit comments

Comments
 (0)