You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!--
Important: Before developing new features, please open an issue to
discuss your ideas with the maintainers. This ensures project alignment
and helps avoid unnecessary work for you.
Thank you for your contribution! Please provide a detailed description
below and ensure you've met all the requirements.
Squashed commit messages must follow the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard to
facilitate changelog generation.
Please ensure your PR title follows the Conventional Commits
specification, using the appropriate type (e.g., feat, fix, docs) and
scope.
Examples of good PR titles:
- 💥feat!: change implementation in an non-backward compatible way
- ✨feat(auth): add support for OAuth2 login
- 🐞fix(router): add support for custom metrics
- 📚docs(README): update installation instructions
- 🧹chore(deps): bump dependencies to latest versions
-->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added explicit subscription heartbeat signaling support to response
writers.
* **Bug Fixes**
* Heartbeats now stop promptly on client disconnect or resolver
shutdown, preventing stray heartbeat errors.
* **Performance**
* Heartbeat emission streamlined to a single writer call, reducing
overhead and improving idle stability.
* **Refactor**
* Consolidated and renamed subscription heartbeat configuration for
clearer setup and consistent behavior.
* **Tests**
* Subscription tests updated to record and verify heartbeat events; test
writers now support heartbeat signaling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Checklist
- [ ] I have discussed my proposed changes in an issue and have received
approval to proceed.
- [ ] I have followed the coding standards of the project.
- [ ] Tests or benchmarks have been added or updated.
<!--
Please add any additional information or context regarding your changes
here.
-->
Copy file name to clipboardExpand all lines: v2/pkg/engine/resolve/resolve.go
+14-26Lines changed: 14 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -21,10 +21,6 @@ const (
21
21
DefaultHeartbeatInterval=5*time.Second
22
22
)
23
23
24
-
var (
25
-
multipartHeartbeat= []byte("{}")
26
-
)
27
-
28
24
// ConnectionIDs is used to create unique connection IDs for each subscription
29
25
// Whenever a new connection is created, use this to generate a new ID
30
26
// It is public because it can be used in more high level packages to instantiate a new connection
@@ -69,7 +65,7 @@ type Resolver struct {
69
65
70
66
propagateSubgraphErrorsbool
71
67
propagateSubgraphStatusCodesbool
72
-
// Multipart heartbeat interval
68
+
// Subscription heartbeat interval
73
69
heartbeatInterval time.Duration
74
70
// maxSubscriptionFetchTimeout defines the maximum time a subscription fetch can take before it is considered timed out
75
71
maxSubscriptionFetchTimeout time.Duration
@@ -143,8 +139,8 @@ type ResolverOptions struct {
143
139
ResolvableOptionsResolvableOptions
144
140
// AllowedCustomSubgraphErrorFields defines which fields are allowed in the subgraph error when in passthrough mode
145
141
AllowedSubgraphErrorFields []string
146
-
// MultipartSubHeartbeatInterval defines the interval in which a heartbeat is sent to all multipart subscriptions
147
-
MultipartSubHeartbeatInterval time.Duration
142
+
// SubscriptionHeartbeatInterval defines the interval in which a heartbeat is sent to all subscriptions (whether or not this does anything is determined by the subscription response writer)
143
+
SubscriptionHeartbeatInterval time.Duration
148
144
// MaxSubscriptionFetchTimeout defines the maximum time a subscription fetch can take before it is considered timed out
149
145
MaxSubscriptionFetchTimeout time.Duration
150
146
// ApolloRouterCompatibilitySubrequestHTTPError is a compatibility flag for Apollo Router, it is used to handle HTTP errors in subrequests differently
0 commit comments