Skip to content

Commit

Permalink
SAST-Create-Report: add pause between report generation requests (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-bostock-cx authored Jan 21, 2025
1 parent c310e02 commit 6eda1aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cx-sast-shell-tools/SAST-Create-Report.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
.PARAMETER report_teams
(Optional) Only generate reports for projects belonging to the specified teams
.PARAMETER pause
(Optional) Pause for this many seconds between report requests
#>
param(
[Parameter(Mandatory = $true)]
Expand All @@ -42,7 +45,9 @@ param(
[Parameter(Mandatory = $false)]
[string]$report_type = "PDF",
[Parameter(Mandatory = $false)]
[string[]]$report_teams = @()
[string[]]$report_teams = @(),
[Parameter(Mandatory = $false)]
[int]$pause = 5
)

. "$PSScriptRoot/support/debug.ps1"
Expand Down Expand Up @@ -117,6 +122,10 @@ $projects | % {
#generate the report
$report = &"$PSScriptRoot/support/soap/generate_report.ps1" $session $scans.id $report_type
$report_index.Add($scans.id, $report)
# If we send too many report generation requests at more or less
# the same time, we can overload the JobsManager. So we pause
# between requests.
Start-Sleep -Seconds $pause
} else {
Write-Debug "No scans found for project $($_.id))"
}
Expand Down

0 comments on commit 6eda1aa

Please sign in to comment.