Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a retry bug in the RetryWhen-based publish flow for function data actions. When publishIntegrationActionDraft failed, the callback was returning (nil, err). Because RetryWhen only retries when resp != nil && shouldRetry(resp, ...), a nil response caused retrying to be silently skipped, making the exponential backoff completely useless during parallel file uploads. The fix returns resp (instead of nil) on failure so the retry condition can be evaluated properly.
Changes:
- Fix
updateFunctionDataActionDraftandcreateFunctionDataActionDraftto return the actualresp(notnil) on publish failure, enabling proper retry behavior. - Extend
containsFunctionDataActionto also normalize hyphens to spaces (alongside existing underscore normalization), and update schema/docs descriptions accordingly. - Correct the documentation example to use a category (
"Genesys Cloud Function Data Action") that actually matches the function data action detection logic.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
genesyscloud/integration_action/resource_genesyscloud_integration_action.go |
Returns resp on publish failure (core fix); adds debug log statements with a nil-dereference risk |
genesyscloud/integration_action/resource_genesyscloud_integration_action_schema.go |
Updates category field description to document function data action detection behavior |
docs/resources/integration_action.md |
Corrects example category, expands doc comments to accurately describe detection logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
genesyscloud/integration_action/resource_genesyscloud_integration_action.go
Outdated
Show resolved
Hide resolved
genesyscloud/integration_action/resource_genesyscloud_integration_action.go
Outdated
Show resolved
Hide resolved
| resp, err := iap.publishIntegrationActionDraft(ctx, id, version+1) | ||
| if err != nil { | ||
| return nil, util.BuildAPIDiagnosticError(ResourceType, fmt.Sprintf("Failed to publish integration action %s error: %s", name, err), resp) | ||
| log.Printf("DEBUG: Publish failed with status %d", resp.StatusCode) |
There was a problem hiding this comment.
if err != nil {
if resp != nil {
log.Printf("DEBUG: Publish failed with status %d", resp.StatusCode)
}
return resp, ...
}
There was a problem hiding this comment.
once this is done. will merge the PR. @luroess
Hello,
we encountered following issue with
RetryWhen, the retry only happens whenresp != nil && shouldRetry(resp, ...). The functionsupdateFunctionDataActionDraft&createFunctionDataActionDraftwere returning nil as the response on failure. This meantresp != nilwasfalse, soRetryWhenskipped retrying and making the backoff completely useless. This error was encountered during uploading multiple files in parallel and causing publish failures.Changes:
Thank you in advance I would appreciate a review and testing from Genesys side.