Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC forward_timeout option #308

Merged
merged 7 commits into from
Jan 15, 2024
Merged

RPC forward_timeout option #308

merged 7 commits into from
Jan 15, 2024

Conversation

KSDaemon
Copy link
Collaborator

Description, Motivation and Context

WAMP Spec in the Call Timeout section describes the forward_timeout property and how it should be used:

If the Callee supports Call Timeouts, the Dealer MAY propagate the CALL.Options.timeout|integer option via the INVOCATION message and allow the Callee to handle the timeout logic. If the operation times out, the Callee MUST return an ERROR message with wamp.error.timeout as the reason URI.

Callees wanting to handle the timeout logic MAY specify this intention via the REGISTER.Options.forward_timeout|boolean option. The Dealer, upon receiving a CALL with the timeout option set, checks if the matching RPC registration had the forward_timeout option set, then accordingly either forwards the timeout value or handles the timeout logic locally without forwarding the timeout value.

This PR introduces such option processing and by the way, fixes the timeout logic. Previously if the timeout was specified by the Caller - it was handled by the router and propagated to the Callee at the same time and only in case when Callee supports it (see snippet below):

	timeout, _ := wamp.AsInt64(invk.options[wamp.OptTimeout])
	if timeout > 0 {
		// Check that callee supports call_timeout.
		if callee.HasFeature(wamp.RoleCallee, wamp.FeatureCallTimeout) {
			details[wamp.OptTimeout] = timeout
		} else {
			timeout = 0
		}
	}

This PR depends on #307. After that is merged this one will be rebased to reflect only relevant changes.

What kind of change does this PR introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • Overall test coverage is not decreased.
  • All new and existing tests passed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

# Conflicts:
#	router/dealer.go
@KSDaemon
Copy link
Collaborator Author

Okay... I'll merge it.

@KSDaemon KSDaemon merged commit 0a75778 into v3 Jan 15, 2024
6 checks passed
@KSDaemon KSDaemon deleted the call-timeout-fix branch January 15, 2024 11:21
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.

None yet

1 participant