mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat: added better message on heartbeat
This commit is contained in:
@@ -46,14 +46,15 @@ var gatewayCmd = &cobra.Command{
|
||||
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
|
||||
sigStopCh := make(chan bool, 1)
|
||||
|
||||
ctx, cancel := context.WithCancel(cmd.Context())
|
||||
defer cancel()
|
||||
|
||||
go func() {
|
||||
<-sigCh
|
||||
close(sigStopCh)
|
||||
cancel()
|
||||
}()
|
||||
|
||||
ctx, cancel := context.WithCancel(cmd.Context())
|
||||
defer cancel()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-sigStopCh:
|
||||
|
||||
@@ -155,7 +155,7 @@ func (g *Gateway) Listen(ctx context.Context) error {
|
||||
})
|
||||
|
||||
errCh := make(chan error, 1)
|
||||
log.Info().Msg("Connector started successfully")
|
||||
log.Info().Msg("Gateway started successfully")
|
||||
g.registerHeartBeat(errCh, done)
|
||||
g.registerRelayIsActive(relayNonTlsConn.Addr().String(), errCh, done)
|
||||
|
||||
@@ -235,8 +235,8 @@ func (g *Gateway) registerHeartBeat(errCh chan error, done chan bool) {
|
||||
ticker := time.NewTicker(1 * time.Hour)
|
||||
|
||||
go func() {
|
||||
// wait for 5 mins
|
||||
time.Sleep(5 * time.Second)
|
||||
time.Sleep(10 * time.Second)
|
||||
log.Info().Msg("Registering first heart beat")
|
||||
err := api.CallGatewayHeartBeatV1(g.httpClient)
|
||||
if err != nil {
|
||||
log.Error().Msgf("Failed to register heartbeat: %s", err)
|
||||
@@ -248,6 +248,7 @@ func (g *Gateway) registerHeartBeat(errCh chan error, done chan bool) {
|
||||
ticker.Stop()
|
||||
return
|
||||
case <-ticker.C:
|
||||
log.Info().Msg("Registering heart beat")
|
||||
err := api.CallGatewayHeartBeatV1(g.httpClient)
|
||||
errCh <- err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user