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

Move closing DatagramChannel to the close method #1080

Merged
merged 1 commit into from Feb 20, 2017

Conversation

arteam
Copy link
Member

@arteam arteam commented Feb 19, 2017

We can align GraphiteUDP with the TCP based Graphite and close the
socket in the close method instead of the connect method. The close
method will be invoked every time after a portion of metrics has been
sent, so we can close the socket there. We also do not need to call
the method isConnected during sending metrics because the socket is
opened right before sending data, so it can't be closed by timeout.

We can align `GraphiteUDP` with the TCP based `Graphite` and close the
socket in the `close` method instead of the connect method. The close
method will be invoked every time after a portion of metrics has been
sent, so we can close the socket there. We also do not need to call
the method `isConnected` during sending metrics because the socket is
opened right before sending data, so it can't be closed by timeout.
ryantenney
ryantenney previously approved these changes Feb 19, 2017
Copy link
Contributor

@ryantenney ryantenney left a comment

Choose a reason for hiding this comment

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

Let me take a closer look at this tomorrow before merging, please.

@ryantenney ryantenney dismissed their stale review February 20, 2017 05:18

Didn't mean to approve it

@ryantenney
Copy link
Contributor

I think I understand, since we now always close the socket after reporting a batch of metrics, it doesn't make sense to wait for the next connect call to close the DatagramSocket?

@arteam
Copy link
Member Author

arteam commented Feb 20, 2017

Right. The close method is always invoked, so we can close the socket there instead leaving it open and closing on the next connection.

@arteam arteam merged commit d18b6ab into 3.2-development Feb 20, 2017
@arteam arteam deleted the graphite_udp branch February 20, 2017 07:31
@jplock jplock added this to the 3.2.0 milestone Feb 24, 2017
arteam added a commit that referenced this pull request Mar 10, 2017
We can align `GraphiteUDP` with the TCP based `Graphite` and close the
socket in the `close` method instead of the connect method. The close
method will be invoked every time after a portion of metrics has been
sent, so we can close the socket there. We also do not need to call
the method `isConnected` during sending metrics because the socket is
opened right before sending data, so it can't be closed by timeout.

(cherry picked from commit d18b6ab)
arteam added a commit that referenced this pull request Mar 10, 2017
We can align `GraphiteUDP` with the TCP based `Graphite` and close the
socket in the `close` method instead of the connect method. The close
method will be invoked every time after a portion of metrics has been
sent, so we can close the socket there. We also do not need to call
the method `isConnected` during sending metrics because the socket is
opened right before sending data, so it can't be closed by timeout.

(cherry picked from commit d18b6ab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants