Skip to content

Commit a948f7a

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 a948f7a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tasks/start_sql_agent_job.ps1

+5-3
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ foreach ($instance in $SQLInstances) {
7979
return (Write-BoltError $message)
8080
}
8181
$selectedJob.start($jobName)
82-
# It takes the server a little time to spin up the job. If we don't do this here
83-
# then the -wait parameter may not work later.
84-
Start-Sleep -Milliseconds 300
8582
}
8683
}
84+
85+
# It takes the server a little time to spin up the job. If we don't do this here
86+
# then the -wait parameter may not work later.
87+
Start-Sleep -Seconds 1
8788
}
8889

8990
do {
@@ -96,6 +97,7 @@ do {
9697
}
9798
[void]$finishedJobs.add((New-CustomJobObject -job $job))
9899
}
100+
Start-Sleep -Milliseconds 300
99101
} while ($wait -and !$done)
100102

101103
$return.jobs = $finishedJobs

0 commit comments

Comments
 (0)