fix(retry): retry transient edge answers centrally, fix stale task test (#57)
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 21s
Tests / Test (Go stable) (pull_request) Successful in 21s
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 21s
Tests / Test (Go stable) (pull_request) Successful in 21s
- Route HTTP helpers (getJSON/formRequest/deleteReq/postJSON/putJSON/ multipart upload), Query and AuthenticateContext/ensureToken through the deterministic 429/502/503/504 retry (retryRaw), so the integration suite no longer fails on the shared openresty rate limit under parallel runs. - Fix stale cmd/office/fetch integration test: loader.TaskFields was replaced by loader.DetailForm (broke go vet -tags=integration). - Add unit tests for Transient/DoRetry.
This commit is contained in:
@@ -2,6 +2,7 @@ package onlyoffice
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"regexp"
|
||||
"time"
|
||||
)
|
||||
@@ -58,3 +59,16 @@ func DoRetry(ctx context.Context, p RetryPolicy, fn func() error) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// retryRaw runs a transport attempt under the default transient-retry policy
|
||||
// and returns its raw payload. All HTTP helpers and Query() go through it, so
|
||||
// an openresty 429/502/503/504 is retried exactly like every bulk tool.
|
||||
func retryRaw(ctx context.Context, fn func() (json.RawMessage, error)) (json.RawMessage, error) {
|
||||
var raw json.RawMessage
|
||||
err := DoRetry(ctx, DefaultRetryPolicy(), func() error {
|
||||
var e error
|
||||
raw, e = fn()
|
||||
return e
|
||||
})
|
||||
return raw, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user