Skip to content

Commit

Permalink
Merge pull request #360 from Martchus/submit-throttle
Browse files Browse the repository at this point in the history
Fix sporadic error about broken pipe when checking recent SRs
  • Loading branch information
mergify[bot] authored Dec 5, 2024
2 parents 4e79384 + 6112aa4 commit 2cb5967
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions os-autoinst-obs-auto-submit
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ if [[ -e job_post_skip_submission ]]; then
fi

# throttle number of submissions to allow only one SR within a certain number of days
if [[ $throttle_days != 0 ]] && $osc request list --project "$dst_project" --type submit --state new,review --mine --days "$throttle_days" | grep --quiet 'Created by'; then
echo "Skipping submission, there is still a pending SR younger than $throttle_days."
# note: Avoid using `grep --quiet` here to keep consuming input so osc does not run into "BrokenPipeError: [Errno 32] Broken pipe".
if [[ $throttle_days != 0 ]] && $osc request list --project "$dst_project" --type submit --state new,review --mine --days "$throttle_days" | grep 'Created by' > /dev/null; then
echo "Skipping submission, there is still a pending SR younger than $throttle_days days."
exit 0
fi

Expand Down

0 comments on commit 2cb5967

Please sign in to comment.