From 2ec5a405cc9cd7953d96625010a2278c1cf56bfb Mon Sep 17 00:00:00 2001 From: patrickhuie19 Date: Mon, 16 Dec 2024 09:59:55 -0500 Subject: [PATCH] fixing duration^2 bug --- core/services/chainlink/application.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index 4a7df4d5636..429ec885f90 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -83,7 +83,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/plugins" ) -const APPLICATION_HEARTBEAT_SECONDS = 1 +const ApplicationHeartbeatSeconds = 1 // Application implements the common functions used in the core node. type Application interface { @@ -218,7 +218,7 @@ type ApplicationHeartbeat struct { func NewApplicationHeartbeat(lggr logger.Logger) ApplicationHeartbeat { h := ApplicationHeartbeat{ - beat: APPLICATION_HEARTBEAT_SECONDS * time.Second, + beat: ApplicationHeartbeatSeconds * time.Second, lggr: lggr, } h.Service, h.eng = commonservices.Config{ @@ -248,17 +248,18 @@ func (h *ApplicationHeartbeat) start(_ context.Context) error { _, innerSpan := beholder.GetTracer().Start(engCtx, "heartbeat.beat") defer innerSpan.End() - h.lggr.Critical("heartbeat") gauge.Record(engCtx, 1) count.Record(engCtx, 1) - cme.Emit(engCtx, "heartbeat") - panic("yo dawg") + err = cme.Emit(engCtx, "heartbeat") + if err != nil { + h.lggr.Errorw("heartbeat emit failed", "err", err) + } } // consistent tick period constantTickFn := func() time.Duration { - return time.Second * h.beat + return h.beat } h.eng.GoTick(timeutil.NewTicker(constantTickFn), tickFn)