Skip to content

Conversation

@scottf
Copy link
Contributor

@scottf scottf commented Aug 19, 2024

When a "request" was made, there were two pieces of code
called in succession

  1. put message in queue
  2. flush socket
    The intention was that on a request, we want to get the publish part of the request out over the socket quickly. But because operation 1 simply queues the message, the flush likely happens before the message even got moved to the socket

So instead of the 2 step process that was did not do what was intended, I added internally the ability to say "flush right after this publish"
It sets a flag on the message in the queue and when processing that message for the queue, when I see the flag, I flush

So instead of the 2 steps, I now do a publish and set the flag on that message.

This only affects "requests" which is what was originally intended. This does not affect publishing.

@scottf scottf requested a review from MauriceVanVeen August 19, 2024 23:30
* Flushes the underlying connection buffer the next chance it gets if the connection is valid.
* @throws IOException not applicable even though it's part of the signature due to implementation change
* Immediately flushes the underlying connection buffer if the connection is valid.
* @throws IOException the connection flush fails
Copy link
Member

Choose a reason for hiding this comment

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

*if the connection flush fails

}

NatsMessage msg = this.poll(timeout);
NatsPublishableMessage msg = (NatsPublishableMessage)this.poll(timeout);
Copy link
Member

Choose a reason for hiding this comment

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

Is this cast safe, poll(..) returns NatsMessage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so because of single reader mode but I will review

@scottf scottf requested a review from MauriceVanVeen August 20, 2024 15:16
@scottf scottf merged commit 7f7caef into main Aug 20, 2024
@scottf scottf deleted the put-locks-back branch August 20, 2024 19:29
* Flushes the underlying connection buffer the next chance it gets if the connection is valid.
* @throws IOException not applicable even though it's part of the signature due to implementation change
* Immediately flushes the underlying connection buffer if the connection is valid.
* @throws IOException if the connection flush fails
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This simply reverts the comments back to the original, correct comment.

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