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

Prevent pc.prch blocking #327

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions consumer/push_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,37 +148,37 @@ func (pc *pushConsumer) Start() error {
return
}

pc.Rebalance()
time.Sleep(1 * time.Second)

go func() {
// initial lock.
time.Sleep(1000 * time.Millisecond)
pc.lockAll()

// todo start clean msg expired
for {
select {
case <-pc.lockTicker.C:
pc.lockAll()
case pr := <-pc.prCh:
go func() {
pc.pullMessage(&pr)
}()
case <-pc.done:
rlog.Info("push consumer close tick.", map[string]interface{}{
rlog.Info("push consumer close pullConsumer listener.", map[string]interface{}{
rlog.LogKeyConsumerGroup: pc.consumerGroup,
})
return
}
}
}()

pc.Rebalance()
time.Sleep(1 * time.Second)

go func() {
// todo start clean msg expired
// initial lock.
time.Sleep(1000 * time.Millisecond)
pc.lockAll()

for {
select {
case pr := <-pc.prCh:
go func() {
pc.pullMessage(&pr)
}()
case <-pc.lockTicker.C:
pc.lockAll()
case <-pc.done:
rlog.Info("push consumer close pullConsumer listener.", map[string]interface{}{
rlog.Info("push consumer close tick.", map[string]interface{}{
rlog.LogKeyConsumerGroup: pc.consumerGroup,
})
return
Expand Down