embed mutex
This commit is contained in:
parent
bbc830a399
commit
f7d38b3985
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
type interestCache struct {
|
||||
mu sync.Mutex
|
||||
sync.Mutex
|
||||
loaded bool
|
||||
postings map[time.Time][]posting.Posting
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ type interestCache struct {
|
|||
var icache interestCache
|
||||
|
||||
func loadInterestCache(db *gorm.DB) {
|
||||
icache.mu.Lock()
|
||||
defer icache.mu.Unlock()
|
||||
icache.Lock()
|
||||
defer icache.Unlock()
|
||||
|
||||
if icache.loaded {
|
||||
return
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
type priceCache struct {
|
||||
mu sync.Mutex
|
||||
sync.Mutex
|
||||
loaded bool
|
||||
pricesTree map[string]*btree.BTree
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ type priceCache struct {
|
|||
var pcache priceCache
|
||||
|
||||
func loadPriceCache(db *gorm.DB) {
|
||||
pcache.mu.Lock()
|
||||
defer pcache.mu.Unlock()
|
||||
pcache.Lock()
|
||||
defer pcache.Unlock()
|
||||
|
||||
if pcache.loaded {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue