Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: added better message on heartbeat

=9b44972e7794
diff --git a/cli/packages/cmd/gateway.go b/cli/packages/cmd/gateway.go
index 4972006479..fc45080ac1 100644
--- a/cli/packages/cmd/gateway.go
+++ b/cli/packages/cmd/gateway.go
@@ -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:
diff --git a/cli/packages/gateway/gateway.go b/cli/packages/gateway/gateway.go
index cfa4fe24a6..a8de875beb 100644
--- a/cli/packages/gateway/gateway.go
+++ b/cli/packages/gateway/gateway.go
@@ -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
}