[#873] node: Start metrics and pprof as soon as possible
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 3m24s
DCO action / DCO (pull_request) Successful in 3m49s
Build / Build Components (1.21) (pull_request) Successful in 4m15s
Build / Build Components (1.20) (pull_request) Successful in 4m32s
Tests and linters / Staticcheck (pull_request) Successful in 5m30s
Tests and linters / Lint (pull_request) Successful in 6m29s
Tests and linters / Tests (1.20) (pull_request) Successful in 10m21s
Tests and linters / Tests with -race (pull_request) Successful in 10m21s
Tests and linters / Tests (1.21) (pull_request) Successful in 10m35s
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 3m24s
DCO action / DCO (pull_request) Successful in 3m49s
Build / Build Components (1.21) (pull_request) Successful in 4m15s
Build / Build Components (1.20) (pull_request) Successful in 4m32s
Tests and linters / Staticcheck (pull_request) Successful in 5m30s
Tests and linters / Lint (pull_request) Successful in 6m29s
Tests and linters / Tests (1.20) (pull_request) Successful in 10m21s
Tests and linters / Tests with -race (pull_request) Successful in 10m21s
Tests and linters / Tests (1.21) (pull_request) Successful in 10m35s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
d69d318cb0
commit
4bf241109b
2 changed files with 9 additions and 21 deletions
|
@ -36,21 +36,19 @@ func (cmp *httpComponent) init(c *cfg) {
|
||||||
cmp.shutdownDur,
|
cmp.shutdownDur,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
c.wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer c.wg.Done()
|
||||||
|
|
||||||
|
c.log.Info(logs.FrostFSNodeStartListeningEndpoint,
|
||||||
|
zap.String("service", cmp.name),
|
||||||
|
zap.String("endpoint", cmp.address))
|
||||||
|
fatalOnErr(srv.Serve())
|
||||||
|
}()
|
||||||
c.closers = append(c.closers, closer{
|
c.closers = append(c.closers, closer{
|
||||||
cmp.name,
|
cmp.name,
|
||||||
func() { stopAndLog(c, cmp.name, srv.Shutdown) },
|
func() { stopAndLog(c, cmp.name, srv.Shutdown) },
|
||||||
})
|
})
|
||||||
c.workers = append(c.workers, worker{
|
|
||||||
cmp.name,
|
|
||||||
func(ctx context.Context) {
|
|
||||||
runAndLog(ctx, c, cmp.name, false, func(context.Context, *cfg) {
|
|
||||||
c.log.Info(logs.FrostFSNodeStartListeningEndpoint,
|
|
||||||
zap.String("service", cmp.name),
|
|
||||||
zap.String("endpoint", cmp.address))
|
|
||||||
fatalOnErr(srv.Serve())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cmp *httpComponent) reload(ctx context.Context) error {
|
func (cmp *httpComponent) reload(ctx context.Context) error {
|
||||||
|
@ -64,7 +62,6 @@ func (cmp *httpComponent) reload(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
// Cleanup
|
// Cleanup
|
||||||
delCloser(cmp.cfg, cmp.name)
|
delCloser(cmp.cfg, cmp.name)
|
||||||
delWorker(cmp.cfg, cmp.name)
|
|
||||||
// Init server with new parameters
|
// Init server with new parameters
|
||||||
cmp.init(cmp.cfg)
|
cmp.init(cmp.cfg)
|
||||||
// Start worker
|
// Start worker
|
||||||
|
|
|
@ -30,15 +30,6 @@ func startWorker(ctx context.Context, c *cfg, wrk worker) {
|
||||||
}(wrk)
|
}(wrk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func delWorker(c *cfg, name string) {
|
|
||||||
for i, worker := range c.workers {
|
|
||||||
if worker.name == name {
|
|
||||||
c.workers = append(c.workers[:i], c.workers[i+1:]...)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getWorker(c *cfg, name string) *worker {
|
func getWorker(c *cfg, name string) *worker {
|
||||||
for _, wrk := range c.workers {
|
for _, wrk := range c.workers {
|
||||||
if wrk.name == name {
|
if wrk.name == name {
|
||||||
|
|
Loading…
Reference in a new issue