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

Add PeekChan function #24

Merged
merged 1 commit into from
Oct 17, 2021
Merged

Add PeekChan function #24

merged 1 commit into from
Oct 17, 2021

Conversation

StoneYunZhao
Copy link
Contributor

@StoneYunZhao StoneYunZhao commented Jan 11, 2021

As described in #6 , we want to read the first element of the queue but not dequeued.

Here is pseudocode for some peek case.

for <condition> {
  if test(<- dq.PeekChan()) {
    <-dq.ReadChan() // move to next element
  }
}

func test(buf []byte) bool {
  // maybe send to remote
  // or run a long time job which should retry if failed
}

@mreiferson
Copy link
Member

Thanks for the PR, this seems reasonable to me.

@ploxiln
Copy link
Member

ploxiln commented Sep 13, 2021

@StoneYunZhao can you rebase on latest master?

@mreiferson mreiferson mentioned this pull request Sep 13, 2021
@StoneYunZhao
Copy link
Contributor Author

@StoneYunZhao can you rebase on latest master?

Done.

@ploxiln
Copy link
Member

ploxiln commented Sep 13, 2021

uh, that rebase went wrong somehow, maybe I can fix it ...

@ploxiln
Copy link
Member

ploxiln commented Sep 13, 2021

(ah, you fixed it, thanks)

@StoneYunZhao
Copy link
Contributor Author

uh, that rebase went wrong somehow, maybe I can fix it ...

Sorry, I tried to fix it, is it okay now?

@ploxiln ploxiln merged commit cc41549 into nsqio:master Oct 17, 2021
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.

3 participants