diff --git a/.github/workflows/sync-cloud-run-env.yml b/.github/workflows/sync-cloud-run-env.yml index 07a7e3d..736c04b 100644 --- a/.github/workflows/sync-cloud-run-env.yml +++ b/.github/workflows/sync-cloud-run-env.yml @@ -1258,9 +1258,11 @@ jobs: --http-method=POST \ --oidc-service-account-email="${GCP_SCHEDULER_SERVICE_ACCOUNT}" \ --oidc-token-audience="${service_url}" \ - --attempt-deadline=120s \ - --max-retry-attempts=0 \ - --max-retry-duration=0s \ + --attempt-deadline=180s \ + --max-retry-attempts=3 \ + --min-backoff=120s \ + --max-backoff=300s \ + --max-retry-duration=900s \ --quiet else echo "Creating Cloud Scheduler precheck ${precheck_job_name} at ${desired_precheck_schedule}." @@ -1273,9 +1275,11 @@ jobs: --http-method=POST \ --oidc-service-account-email="${GCP_SCHEDULER_SERVICE_ACCOUNT}" \ --oidc-token-audience="${service_url}" \ - --attempt-deadline=120s \ - --max-retry-attempts=0 \ - --max-retry-duration=0s \ + --attempt-deadline=180s \ + --max-retry-attempts=3 \ + --min-backoff=120s \ + --max-backoff=300s \ + --max-retry-duration=900s \ --quiet fi managed_scheduler_jobs=("${job_name}" "${warmup_job_name}" "${precheck_job_name}") diff --git a/tests/test_scheduler_deadline_contract.py b/tests/test_scheduler_deadline_contract.py index c02b733..0095648 100644 --- a/tests/test_scheduler_deadline_contract.py +++ b/tests/test_scheduler_deadline_contract.py @@ -50,9 +50,12 @@ def test_precheck_uses_per_service_scheduler_with_bounded_deadline() -> None: assert 'precheck_job_name="${cloud_run_service%-service}-precheck-scheduler"' in workflow assert 'precheck_uri="${service_url}/dry-run"' in workflow - assert workflow.count("--attempt-deadline=120s") == 2 - assert workflow.count("--max-retry-attempts=0") == 2 - assert workflow.count("--max-retry-duration=0s") == 2 + assert workflow.count("--attempt-deadline=180s") == 2 + assert workflow.count("--max-retry-attempts=3") == 2 + assert workflow.count("--min-backoff=120s") == 2 + assert workflow.count("--max-backoff=300s") == 2 + assert workflow.count("--max-retry-duration=900s") == 2 + assert workflow.count("--max-retry-attempts=0") == 0 assert 'managed_scheduler_jobs=("${job_name}" "${warmup_job_name}" "${precheck_job_name}")' in workflow assert 'monitor_job_name="interactive-brokers-monitor-dispatcher-scheduler"' not in workflow assert 'shared_env_pairs+=("IBKR_MONITOR_DISPATCH_TARGETS_JSON=' not in workflow diff --git a/tests/test_sync_cloud_run_env_workflow.sh b/tests/test_sync_cloud_run_env_workflow.sh index a5b9d8d..9d4faf5 100644 --- a/tests/test_sync_cloud_run_env_workflow.sh +++ b/tests/test_sync_cloud_run_env_workflow.sh @@ -180,9 +180,14 @@ grep -Fq 'precheck_job_name="${cloud_run_service%-service}-precheck-scheduler"' grep -Fq 'precheck_uri="${service_url}/dry-run"' "$workflow_file" grep -Fq 'gcloud scheduler jobs update http "${precheck_job_name}"' "$workflow_file" grep -Fq 'gcloud scheduler jobs create http "${precheck_job_name}"' "$workflow_file" -test "$(grep -Fc -- '--attempt-deadline=120s' "$workflow_file")" -eq 2 -test "$(grep -Fc -- '--max-retry-attempts=0' "$workflow_file")" -eq 2 -test "$(grep -Fc -- '--max-retry-duration=0s' "$workflow_file")" -eq 2 +# Precheck may collide with other dry-runs on maxScale=1; retry transient 429s. +# Keep /run without these retries to avoid duplicate live submits. +test "$(grep -Fc -- '--attempt-deadline=180s' "$workflow_file")" -eq 2 +test "$(grep -Fc -- '--max-retry-attempts=3' "$workflow_file")" -eq 2 +test "$(grep -Fc -- '--min-backoff=120s' "$workflow_file")" -eq 2 +test "$(grep -Fc -- '--max-backoff=300s' "$workflow_file")" -eq 2 +test "$(grep -Fc -- '--max-retry-duration=900s' "$workflow_file")" -eq 2 +test "$(grep -Fc -- '--max-retry-attempts=0' "$workflow_file")" -eq 0 grep -Fq 'managed_scheduler_jobs=("${job_name}" "${warmup_job_name}" "${precheck_job_name}")' "$workflow_file" grep -Fq 'for managed_job_name in "${managed_scheduler_jobs[@]}"; do' "$workflow_file" grep -Fq 'gcloud scheduler jobs resume "${managed_job_name}"' "$workflow_file"