mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
Only have one context err handling block
This commit is contained in:
parent
f47155b8bb
commit
5e4d0c736a
1 changed files with 5 additions and 1 deletions
|
@ -271,7 +271,7 @@ func (w *worker) _next() {
|
||||||
})
|
})
|
||||||
msgs, err := w.subscription.Fetch(1, nats.Context(ctx))
|
msgs, err := w.subscription.Fetch(1, nats.Context(ctx))
|
||||||
switch err {
|
switch err {
|
||||||
case nil, nats.ErrTimeout, context.DeadlineExceeded, context.Canceled:
|
case nil, nats.ErrTimeout:
|
||||||
// Is the server shutting down? If so, stop processing.
|
// Is the server shutting down? If so, stop processing.
|
||||||
if w.r.ProcessContext.Context().Err() != nil {
|
if w.r.ProcessContext.Context().Err() != nil {
|
||||||
return
|
return
|
||||||
|
@ -286,6 +286,10 @@ func (w *worker) _next() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case context.DeadlineExceeded, context.Canceled:
|
case context.DeadlineExceeded, context.Canceled:
|
||||||
|
// Is the server shutting down? If so, stop processing.
|
||||||
|
if w.r.ProcessContext.Context().Err() != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
// The context exceeded, so we've been waiting for more than a
|
// The context exceeded, so we've been waiting for more than a
|
||||||
// minute for activity in this room. At this point we will shut
|
// minute for activity in this room. At this point we will shut
|
||||||
// down the subscriber to free up resources. It'll get started
|
// down the subscriber to free up resources. It'll get started
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue