Skip to content

Commit

Permalink
Merge pull request #209 from xmidt-org/remove-queueEmpty
Browse files Browse the repository at this point in the history
removed queueEmpty variable from outbound sender
  • Loading branch information
schmidtw authored May 13, 2020
2 parents b887423 + 61d0dc1 commit 0723afd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
- cleaned up shutdown logic for outbound sender [#205](https://github.com/xmidt-org/caduceus/pull/205)
- added resetting queue depth and current workers gauges to outbound sender [#205](https://github.com/xmidt-org/caduceus/pull/205)
- removed queueEmpty variable from outbound sender [#209](https://github.com/xmidt-org/caduceus/pull/209)

## [v0.2.7]
- pared down logging, especially debugging logs [#196](https://github.com/xmidt-org/caduceus/pull/196)
Expand Down
7 changes: 1 addition & 6 deletions outboundSender.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ type CaduceusOutboundSender struct {
failureMsg FailureMessage
logger log.Logger
mutex sync.RWMutex
queueEmpty bool
queue atomic.Value
}

Expand Down Expand Up @@ -197,7 +196,6 @@ func (osf OutboundSenderFactory) New() (obs OutboundSender, err error) {
QueueSize: osf.QueueSize,
Workers: osf.NumWorkers,
},
queueEmpty: true,
}

// Don't share the secret with others when there is an error.
Expand Down Expand Up @@ -427,7 +425,7 @@ func (obs *CaduceusOutboundSender) Queue(msg *wrp.Message) {
}

func (obs *CaduceusOutboundSender) isValidTimeWindow(now, dropUntil, deliverUntil time.Time) bool {
if false == now.After(dropUntil) || !obs.queueEmpty {
if false == now.After(dropUntil) {
// client was cut off
obs.droppedCutoffCounter.Add(1.0)
return false
Expand All @@ -447,8 +445,6 @@ func (obs *CaduceusOutboundSender) Empty(droppedCounter metrics.Counter) {
obs.queue.Store(make(chan *wrp.Message, obs.queueSize))
droppedCounter.Add(float64(len(droppedMsgs)))
obs.queueDepthGauge.Set(0.0)
obs.queueEmpty = true

return
}

Expand Down Expand Up @@ -620,7 +616,6 @@ func (obs *CaduceusOutboundSender) queueOverflow() {
obs.mutex.Unlock()
return
}
obs.queueEmpty = false
obs.dropUntil = time.Now().Add(obs.cutOffPeriod)
obs.dropUntilGauge.Set(float64(obs.dropUntil.Unix()))
secret := obs.listener.Config.Secret
Expand Down

0 comments on commit 0723afd

Please sign in to comment.