Server endpoints goroutine refactor #69

Merged
jeffreypicard merged 18 commits from server-endpoints-goroutine-refactor into master 2022-10-25 07:48:13 +02:00
4 changed files with 4 additions and 6 deletions
Showing only changes of commit ffaacc0985 - Show all commits

View file

@ -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,

View file

@ -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,

View file

@ -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?
moodyjon commented 2022-10-19 15:57:30 +02:00 (Migrated from github.com)
Review

Not needed.

Not needed.
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 {
moodyjon commented 2022-10-14 16:20:05 +02:00 (Migrated from github.com)
Review

Ahaa. So this is how it gets set. You might consider passing grp down into LoadDatabase(). So it gets initialized ASAP. Also, don't forget the ReadonlyDBColumnFamilies instance constructed in db_test.go.

Ahaa. So this is how it gets set. You might consider passing `grp` down into `LoadDatabase()`. So it gets initialized ASAP. Also, don't forget the `ReadonlyDBColumnFamilies` instance constructed in db_test.go.
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

View file

@ -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