Merged
Conversation
57a1871 to
b23033d
Compare
There was a problem hiding this comment.
Pull request overview
Adds a configurable timeout for establishing new AMQP connections (socket connect + AMQP handshake) in @effect-messaging/amqp, defaulting to 10 seconds, and extends the test suite to cover the new option.
Changes:
- Introduces
connectionTimeoutinAMQPConnectionOptions(default 10s) and wires it into connection establishment. - Applies both amqplib socket timeout and an Effect-level timeout around
amqplib.connect(...). - Adds new test cases intended to cover default/custom timeout behavior and failure modes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| packages/amqp/src/internal/AMQPConnection.ts | Implements connectionTimeout and applies it during connection initiation. |
| packages/amqp/src/AMQPConnection.ts | Exposes the new option in the public AMQPConnectionOptions API docs. |
| packages/amqp/test/AMQPConnection.test.ts | Adds tests for default/custom timeout configuration and timeout/failure behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+99
to
+103
| if (error._tag === "Fail") { | ||
| expect(error.error).toBeInstanceOf(AMQPError.AMQPConnectionError) | ||
| } | ||
| } | ||
| }).pipe(Effect.scoped)) |
Comment on lines
+85
to
+89
| const { connectionRef, connectionTimeout, url } = yield* InternalAMQPConnection | ||
| yield* Effect.annotateCurrentSpan({ url }) | ||
| yield* SubscriptionRef.updateEffect(connectionRef, () => | ||
| Effect.gen(function*() { | ||
| const normalizedUrl = Redacted.isRedacted(url) ? Redacted.value(url) : url |
Comment on lines
+94
to
+97
| }).pipe( | ||
| Effect.timeout(connectionTimeout), | ||
| Effect.catchTag("TimeoutException", () => new AMQPConnectionError({ reason: "Connection timed out" })) | ||
| ) |
Comment on lines
+95
to
+97
| Effect.timeout(connectionTimeout), | ||
| Effect.catchTag("TimeoutException", () => new AMQPConnectionError({ reason: "Connection timed out" })) | ||
| ) |
Comment on lines
+79
to
+80
| * | ||
| * @since 0.7.0 |
Comment on lines
+79
to
+83
| ) | ||
| ).toBe(true) | ||
| } | ||
| } | ||
| }).pipe(Effect.scoped)) |
wewelll
requested changes
Mar 18, 2026
| { | ||
| private static defaultRetryConnectionSchedule = Schedule.forever.pipe(Schedule.addDelay(() => 1000)) | ||
| private static defaultWaitConnectionTimeout = Duration.seconds(5) | ||
| private static defaultConnectionTimeout = Duration.seconds(10) |
Contributor
There was a problem hiding this comment.
is it a good idea to keep this ?
Contributor
Author
There was a problem hiding this comment.
I think it's a good default. However, maybe we don't want to break consumers of the app? WDYT?
1350a45 to
e9a542a
Compare
wewelll
approved these changes
Mar 19, 2026
e9a542a to
444e50f
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add connection timeout for establishing a new connection