cleanup and add manage goroutine to stopper pattern
This commit is contained in:
parent
67f0ae5e44
commit
ffaacc0985
4 changed files with 4 additions and 6 deletions
|
@ -84,7 +84,6 @@ const (
|
||||||
DefaultBannerFile = ""
|
DefaultBannerFile = ""
|
||||||
DefaultCountry = "US"
|
DefaultCountry = "US"
|
||||||
|
|
||||||
GENESIS_HASH = "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463"
|
|
||||||
HUB_PROTOCOL_VERSION = "0.107.0"
|
HUB_PROTOCOL_VERSION = "0.107.0"
|
||||||
PROTOCOL_MIN = "0.54.0"
|
PROTOCOL_MIN = "0.54.0"
|
||||||
PROTOCOL_MAX = "0.199.0"
|
PROTOCOL_MAX = "0.199.0"
|
||||||
|
@ -303,7 +302,7 @@ func ParseArgs(searchRequest *pb.SearchRequest) *Args {
|
||||||
BlockingChannelIds: *blockingChannelIds,
|
BlockingChannelIds: *blockingChannelIds,
|
||||||
FilteringChannelIds: *filteringChannelIds,
|
FilteringChannelIds: *filteringChannelIds,
|
||||||
|
|
||||||
GenesisHash: GENESIS_HASH,
|
GenesisHash: "",
|
||||||
ServerVersion: HUB_PROTOCOL_VERSION,
|
ServerVersion: HUB_PROTOCOL_VERSION,
|
||||||
ProtocolMin: PROTOCOL_MIN,
|
ProtocolMin: PROTOCOL_MIN,
|
||||||
ProtocolMax: PROTOCOL_MAX,
|
ProtocolMax: PROTOCOL_MAX,
|
||||||
|
|
|
@ -39,7 +39,7 @@ func (t *ServerService) Features(req *ServerFeaturesReq, res **ServerFeaturesRes
|
||||||
ServerVersion: HUB_PROTOCOL_VERSION,
|
ServerVersion: HUB_PROTOCOL_VERSION,
|
||||||
ProtocolMin: PROTOCOL_MIN,
|
ProtocolMin: PROTOCOL_MIN,
|
||||||
ProtocolMax: PROTOCOL_MAX,
|
ProtocolMax: PROTOCOL_MAX,
|
||||||
GenesisHash: GENESIS_HASH,
|
GenesisHash: t.Args.GenesisHash,
|
||||||
Description: t.Args.ServerDescription,
|
Description: t.Args.ServerDescription,
|
||||||
PaymentAddress: t.Args.PaymentAddress,
|
PaymentAddress: t.Args.PaymentAddress,
|
||||||
DonationAddress: t.Args.DonationAddress,
|
DonationAddress: t.Args.DonationAddress,
|
||||||
|
|
|
@ -268,14 +268,11 @@ func MakeHubServer(grp *stop.Group, args *Args) *Server {
|
||||||
|
|
||||||
//TODO: is this the right place to load the db?
|
//TODO: is this the right place to load the db?
|
||||||
var myDB *db.ReadOnlyDBColumnFamily
|
var myDB *db.ReadOnlyDBColumnFamily
|
||||||
// var dbShutdown = func() {}
|
|
||||||
if !args.DisableResolve {
|
if !args.DisableResolve {
|
||||||
myDB, err = LoadDatabase(args, grp)
|
myDB, err = LoadDatabase(args, grp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Warning(err)
|
logrus.Warning(err)
|
||||||
}
|
}
|
||||||
// myDB.Grp = stop.New(grp)
|
|
||||||
// myDB.Grp.Add(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine which chain to use based on db and cli values
|
// Determine which chain to use based on db and cli values
|
||||||
|
|
|
@ -147,6 +147,7 @@ func newSessionManager(db *db.ReadOnlyDBColumnFamily, args *Args, grp *stop.Grou
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *sessionManager) start() {
|
func (sm *sessionManager) start() {
|
||||||
|
sm.grp.Add(1)
|
||||||
go sm.manage()
|
go sm.manage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +176,7 @@ func (sm *sessionManager) manage() {
|
||||||
// Wait for next management clock tick.
|
// Wait for next management clock tick.
|
||||||
select {
|
select {
|
||||||
case <-sm.grp.Ch():
|
case <-sm.grp.Ch():
|
||||||
|
sm.grp.Done()
|
||||||
return
|
return
|
||||||
case <-sm.manageTicker.C:
|
case <-sm.manageTicker.C:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue