3e2c101bd8
* V3-1152 Node bootstrap
20 lines
357 B
Go
20 lines
357 B
Go
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package storjql
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// mu allows to lock graphql methods, because some of them are not thread-safe
|
|
var mu sync.Mutex
|
|
|
|
// WithLock locks graphql methods, because some of them are not thread-safe
|
|
func WithLock(fn func()) {
|
|
mu.Lock()
|
|
defer mu.Unlock()
|
|
|
|
fn()
|
|
}
|