Skip to content

Add Flush#144

Merged
ogaca-dd merged 5 commits intomasterfrom
olivierg/add-flush
Nov 20, 2020
Merged

Add Flush#144
ogaca-dd merged 5 commits intomasterfrom
olivierg/add-flush

Conversation

@ogaca-dd
Copy link
Copy Markdown
Contributor

@ogaca-dd ogaca-dd commented Nov 16, 2020

This PR introduces the Flush method in order to flush without disposing.

It should fix #141

Comment thread src/StatsdClient/DogStatsdService.cs Outdated
public void Flush()
{
_statsdData?.Flush();
_statsdData = null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you dont need to create a new _statsdData?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.


public void Dispose()
{
if (!_terminate)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NIT: could flip this to reduce nesting:
if (_terminate) { return }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tend to use this pattern where there are several return in the function.

@ogaca-dd ogaca-dd merged commit 2ef5b00 into master Nov 20, 2020
@ogaca-dd ogaca-dd deleted the olivierg/add-flush branch November 20, 2020 09:30
@danny-zegel-zocdoc
Copy link
Copy Markdown

@ogaca-dd
Copy link
Copy Markdown
Contributor Author

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.

Cannot Flush without Disposing

4 participants