mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-05-04 23:03:09 +02:00
Don't use "select" with a single case that reads from a channel but read channel directly.
This commit is contained in:
parent
7d874ac1a7
commit
68477474f8
|
@ -288,8 +288,6 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case <-interrupt:
|
||||
log.Println("Interrupted")
|
||||
}
|
||||
<-interrupt
|
||||
log.Println("Interrupted")
|
||||
}
|
||||
|
|
|
@ -148,13 +148,11 @@ func (c *LoopbackNatsClient) Request(subject string, data []byte, timeout time.D
|
|||
c.mu.Unlock()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
defer cancel()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if ctx.Err() == context.DeadlineExceeded {
|
||||
err = nats.ErrTimeout
|
||||
} else {
|
||||
err = ctx.Err()
|
||||
}
|
||||
<-ctx.Done()
|
||||
if ctx.Err() == context.DeadlineExceeded {
|
||||
err = nats.ErrTimeout
|
||||
} else {
|
||||
err = ctx.Err()
|
||||
}
|
||||
c.mu.Lock()
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue