Skip to content

Commit

Permalink
mls: remove unecessary passive ticker from subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Normore committed Jan 20, 2024
1 parent 57bd804 commit cc86db6
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions pkg/mls/api/v1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,19 +412,15 @@ func (s *Service) SubscribeGroupMessages(req *mlsv1.SubscribeGroupMessagesReques
}
}

activeTicker := time.NewTicker(100 * time.Millisecond)
defer activeTicker.Stop()
passiveTicker := time.NewTicker(5 * time.Second)
defer passiveTicker.Stop()
ticker := time.NewTicker(200 * time.Millisecond)
defer ticker.Stop()
for {
select {
case <-stream.Context().Done():
return
case <-s.ctx.Done():
return
case <-passiveTicker.C:
setHasMessages()
case <-activeTicker.C:
case <-ticker.C:
var skip bool
func() {
hasMessagesLock.Lock()
Expand Down Expand Up @@ -545,19 +541,15 @@ func (s *Service) SubscribeWelcomeMessages(req *mlsv1.SubscribeWelcomeMessagesRe
}
}

activeTicker := time.NewTicker(200 * time.Millisecond)
defer activeTicker.Stop()
passiveTicker := time.NewTicker(5 * time.Second)
defer passiveTicker.Stop()
ticker := time.NewTicker(200 * time.Millisecond)
defer ticker.Stop()
for {
select {
case <-stream.Context().Done():
return
case <-s.ctx.Done():
return
case <-passiveTicker.C:
setHasMessages()
case <-activeTicker.C:
case <-ticker.C:
var skip bool
func() {
hasMessagesLock.Lock()
Expand Down

0 comments on commit cc86db6

Please sign in to comment.