Skip to content

Conversation

@vjanelle
Copy link
Member

@vjanelle vjanelle commented Aug 6, 2025

  • Add context cancellation checks to core publishing methods (PublishRaw, PublishRawMsg) in choria/connection.go.
  • Update federation egest, stream adapter, and submission spool to check context before publishing.
  • Improve client publisher to check context before publishing and connecting.

- Add context cancellation checks to core publishing methods (PublishRaw, PublishRawMsg) in choria/connection.go.
- Update federation egest, stream adapter, and submission spool to check context before publishing.
- Improve client publisher to check context before publishing and
  connecting.
@vjanelle vjanelle requested a review from ripienaar August 6, 2025 02:28
@vjanelle vjanelle self-assigned this Aug 6, 2025
@vjanelle
Copy link
Member Author

vjanelle commented Aug 6, 2025

The job failed due to a spelling linter error: the word "cancelled" is used instead of the American English "canceled" in several test files. To fix this, replace all instances of "cancelled" with "canceled" in the following files and lines:

ugh >.>

defer obs.ObserveDuration()
defer func() { workqlen.Set(float64(len(sc.work))) }()

select {
Copy link
Member

Choose a reason for hiding this comment

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

I think all these can be just checking if ctx.Error is nil?

hard to say if this will really help unless the nats.go calls took contexts

Copy link
Member Author

Choose a reason for hiding this comment

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

Less code, same effect - non-blocking.

And yeah, probably not immediately useful.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ripienaar the nats client takes custom dialers so we could use net.DialContext?

Copy link
Member

@ripienaar ripienaar Aug 6, 2025

Choose a reason for hiding this comment

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

That would only be for making the initial connection I think?

Copy link
Member

Choose a reason for hiding this comment

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

Publishing tends to happen into a buffer in the client it wouldn’t block. The only really blocking thing is nc.Request

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.

2 participants