Add connection pool implementation (part 2)
Signed-off-by: Pavel Korotkov <pavel@nspcc.ru>
This commit is contained in:
parent
62a03251ce
commit
a44551d42b
6 changed files with 70 additions and 57 deletions
|
@ -8,16 +8,13 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
globalContext context.Context
|
||||
globalContextOnce sync.Once
|
||||
globalContextBarrier = make(chan struct{})
|
||||
globalContext context.Context
|
||||
globalContextOnce sync.Once
|
||||
)
|
||||
|
||||
func Context() context.Context {
|
||||
globalContextOnce.Do(func() {
|
||||
globalContext, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||
close(globalContextBarrier)
|
||||
})
|
||||
<-globalContextBarrier
|
||||
return globalContext
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue