Skip to content

Commit

Permalink
fixing duration^2 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Dec 16, 2024
1 parent 3acebca commit 2ec5a40
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2ec5a40

Please sign in to comment.