mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Initialize expvar lazily to prevent panic if importing both Pilosa v1 and v2.
This commit is contained in:
parent
5643afac47
commit
8d32005ede
1 changed files with 4 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ import (
|
|||
)
|
||||
|
||||
// Expvar global expvar map.
|
||||
var Expvar = expvar.NewMap("index")
|
||||
var Expvar *expvar.Map
|
||||
|
||||
// StatsClient represents a client to a stats server.
|
||||
type StatsClient interface {
|
||||
|
|
@ -90,6 +90,9 @@ type expvarStatsClient struct {
|
|||
// NewExpvarStatsClient returns a new instance of ExpvarStatsClient.
|
||||
// This client points at the root of the expvar index map.
|
||||
func NewExpvarStatsClient() *expvarStatsClient {
|
||||
if Expvar == nil {
|
||||
Expvar = expvar.NewMap("index")
|
||||
}
|
||||
return &expvarStatsClient{
|
||||
m: Expvar,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue