Skip to content

Helper to calculate average RequestTimeout - #769

Merged
yashnevatia merged 4 commits into
mainfrom
average-unknownTTL
Sep 21, 2026
Merged

yashnevatia merged 4 commits into
mainfrom
average-unknownTTL

Conversation

@yashnevatia

@yashnevatia yashnevatia commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This pull request adds a new helper function for calculating the max request timeout for a capability.

New helper function

  • Added MAxRequestTimeout to helpers.go, which computes the max RequestTimeout across all eligible method configs for a given capability and DON, excluding WriteReport and LogTrigger methods. It uses a retry mechanism for fetching configs and falls back to a default value if necessary.

@github-actions

Copy link
Copy Markdown
Contributor

👋 yashnevatia, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@yashnevatia yashnevatia changed the title Use average requestTimeout as UnknownTTL Helper to calculate averageRequestTimeout Sep 16, 2026
@yashnevatia yashnevatia changed the title Helper to calculate averageRequestTimeout Helper to calculate average RequestTimeout Sep 16, 2026
Comment thread chain_capabilities/common/helpers.go Outdated
// differ from regular executable methods. If the config can't be fetched or no
// eligible RemoteExecutableConfig.RequestTimeout values are found, it returns
// fallback.
func AverageRequestTimeout(ctx context.Context, registry core.CapabilitiesRegistry, capabilityID string, donID uint32, fallback time.Duration, lggr logger.Logger) time.Duration {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use max? If we use avg, there is a chance that an unknown request will expire before the timeout.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a very fair point

@cl-sonarqube-production

Copy link
Copy Markdown

@yashnevatia
yashnevatia added this pull request to the merge queue Sep 21, 2026
Merged via the queue into main with commit b7bf808 Sep 21, 2026
20 checks passed
@yashnevatia
yashnevatia deleted the average-unknownTTL branch September 21, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants