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

avoid background goroutine #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

avoid background goroutine #9

wants to merge 1 commit into from

Conversation

egonelbre
Copy link
Member

No description provided.

Copy link
Member

@jtolio jtolio left a comment

Choose a reason for hiding this comment

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

okay i see, instead of having a long-running processing goroutine, this spawns one per message? the code certainly seems simpler, though i worry this is less efficient

c.pending = c.newOutgoingPacket()
c.flush = make(chan struct{}, 1)
c.active.Add(1)
go c.waitForFull(c.pending, c.flush)
Copy link
Member

Choose a reason for hiding this comment

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

background goroutine?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, sorry, for not being clear -- a long running background goroutine.

@egonelbre
Copy link
Member Author

egonelbre commented Oct 3, 2022

@jtolio with regards to efficiency, it can implement a coalescing queue -- so you'll have a worker only for the time when you are actually sending stuff out.

However, indeed, I'm not quite sure whether this is better in general or not.

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