cleanup and add manage goroutine to stopper pattern

This commit is contained in:
Jeffrey Picard 2022-10-20 09:23:31 +00:00
parent 67f0ae5e44
commit ffaacc0985
4 changed files with 4 additions and 6 deletions

View file

@ -84,7 +84,6 @@ const (
DefaultBannerFile = ""
DefaultCountry = "US"
GENESIS_HASH = "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463"
HUB_PROTOCOL_VERSION = "0.107.0"
PROTOCOL_MIN = "0.54.0"
PROTOCOL_MAX = "0.199.0"
@ -303,7 +302,7 @@ func ParseArgs(searchRequest *pb.SearchRequest) *Args {
BlockingChannelIds: *blockingChannelIds,
FilteringChannelIds: *filteringChannelIds,
GenesisHash: GENESIS_HASH,
GenesisHash: "",
ServerVersion: HUB_PROTOCOL_VERSION,
ProtocolMin: PROTOCOL_MIN,
ProtocolMax: PROTOCOL_MAX,

View file

@ -39,7 +39,7 @@ func (t *ServerService) Features(req *ServerFeaturesReq, res **ServerFeaturesRes
ServerVersion: HUB_PROTOCOL_VERSION,
ProtocolMin: PROTOCOL_MIN,
ProtocolMax: PROTOCOL_MAX,
GenesisHash: GENESIS_HASH,
GenesisHash: t.Args.GenesisHash,
Description: t.Args.ServerDescription,
PaymentAddress: t.Args.PaymentAddress,
DonationAddress: t.Args.DonationAddress,

View file

@ -268,14 +268,11 @@ func MakeHubServer(grp *stop.Group, args *Args) *Server {
//TODO: is this the right place to load the db?
var myDB *db.ReadOnlyDBColumnFamily
// var dbShutdown = func() {}
if !args.DisableResolve {
myDB, err = LoadDatabase(args, grp)
if err != nil {
logrus.Warning(err)
}
// myDB.Grp = stop.New(grp)
// myDB.Grp.Add(1)
}
// Determine which chain to use based on db and cli values

View file

@ -147,6 +147,7 @@ func newSessionManager(db *db.ReadOnlyDBColumnFamily, args *Args, grp *stop.Grou
}
func (sm *sessionManager) start() {
sm.grp.Add(1)
go sm.manage()
}
@ -175,6 +176,7 @@ func (sm *sessionManager) manage() {
// Wait for next management clock tick.
select {
case <-sm.grp.Ch():
sm.grp.Done()
return
case <-sm.manageTicker.C:
continue