Skip to content

Commit 158c320

Browse files
Merge branch 'dev' of github.com:ava-labs/gecko-internal into dev
2 parents 8f441bb + 8e19003 commit 158c320

File tree

2 files changed

+38
-25
lines changed

2 files changed

+38
-25
lines changed

snow/engine/common/queue/jobs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (j *Jobs) Execute(job Job) error {
124124
}
125125
}
126126

127-
return nil
127+
return j.state.DeleteJob(j.db, jobID)
128128
}
129129

130130
// Commit ...

snow/networking/router/chain_router.go

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ func (cr *ChainRouter) GetAcceptedFrontier(validatorID ids.ShortID, chainID ids.
256256
// Pass the message to the chain It's OK if we drop this.
257257
dropped := !chain.GetAcceptedFrontier(validatorID, requestID, deadline)
258258
if dropped {
259-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
259+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
260260
} else {
261-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
261+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
262262
}
263263
}
264264

@@ -297,9 +297,9 @@ func (cr *ChainRouter) AcceptedFrontier(validatorID ids.ShortID, chainID ids.ID,
297297
if dropped {
298298
// We weren't able to pass the response to the chain
299299
chain.GetAcceptedFrontierFailed(validatorID, requestID)
300-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
300+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
301301
} else {
302-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
302+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
303303
}
304304
}
305305

@@ -342,9 +342,9 @@ func (cr *ChainRouter) GetAccepted(validatorID ids.ShortID, chainID ids.ID, requ
342342
// Pass the message to the chain. It's OK if we drop this.
343343
dropped := !chain.GetAccepted(validatorID, requestID, deadline, containerIDs)
344344
if dropped {
345-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
345+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
346346
} else {
347-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
347+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
348348
}
349349
}
350350

@@ -383,9 +383,9 @@ func (cr *ChainRouter) Accepted(validatorID ids.ShortID, chainID ids.ID, request
383383
if dropped {
384384
// We weren't able to pass the response to the chain
385385
chain.GetAcceptedFailed(validatorID, requestID)
386-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
386+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
387387
} else {
388-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
388+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
389389
}
390390
}
391391

@@ -429,9 +429,9 @@ func (cr *ChainRouter) GetAncestors(validatorID ids.ShortID, chainID ids.ID, req
429429
// Pass the message to the chain. It's OK if we drop this.
430430
dropped := !chain.GetAncestors(validatorID, requestID, deadline, containerID)
431431
if dropped {
432-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
432+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
433433
} else {
434-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
434+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
435435
}
436436
}
437437

@@ -469,9 +469,9 @@ func (cr *ChainRouter) MultiPut(validatorID ids.ShortID, chainID ids.ID, request
469469
if dropped {
470470
// We weren't able to pass the response to the chain
471471
chain.GetAncestorsFailed(validatorID, requestID)
472-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
472+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
473473
} else {
474-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
474+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
475475
}
476476
}
477477

@@ -513,9 +513,9 @@ func (cr *ChainRouter) Get(validatorID ids.ShortID, chainID ids.ID, requestID ui
513513
// Pass the message to the chain. It's OK if we drop this.
514514
dropped := !chain.Get(validatorID, requestID, deadline, containerID)
515515
if dropped {
516-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
516+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
517517
} else {
518-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
518+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
519519
}
520520
}
521521

@@ -544,9 +544,9 @@ func (cr *ChainRouter) Put(validatorID ids.ShortID, chainID ids.ID, requestID ui
544544
// It's ok to drop this message.
545545
dropped := !chain.Put(validatorID, requestID, containerID, container)
546546
if dropped {
547-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
547+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
548548
} else {
549-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
549+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
550550
}
551551
return
552552
}
@@ -572,10 +572,11 @@ func (cr *ChainRouter) Put(validatorID ids.ShortID, chainID ids.ID, requestID ui
572572
if dropped {
573573
// We weren't able to pass the response to the chain
574574
chain.GetFailed(validatorID, requestID)
575-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
575+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
576576
} else {
577-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
577+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
578578
}
579+
579580
}
580581

581582
// GetFailed routes an incoming GetFailed message from the validator with ID [validatorID]
@@ -615,9 +616,9 @@ func (cr *ChainRouter) PushQuery(validatorID ids.ShortID, chainID ids.ID, reques
615616
// Pass the message to the chain. It's OK if we drop this.
616617
dropped := !chain.PushQuery(validatorID, requestID, deadline, containerID, container)
617618
if dropped {
618-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
619+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
619620
} else {
620-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
621+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
621622
}
622623
}
623624

@@ -636,9 +637,9 @@ func (cr *ChainRouter) PullQuery(validatorID ids.ShortID, chainID ids.ID, reques
636637
// Pass the message to the chain. It's OK if we drop this.
637638
dropped := !chain.PullQuery(validatorID, requestID, deadline, containerID)
638639
if dropped {
639-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
640+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
640641
} else {
641-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
642+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
642643
}
643644
}
644645

@@ -676,9 +677,9 @@ func (cr *ChainRouter) Chits(validatorID ids.ShortID, chainID ids.ID, requestID
676677
if dropped {
677678
// We weren't able to pass the response to the chain
678679
chain.QueryFailed(validatorID, requestID)
679-
cr.dropRateCalculator.Observe(1, cr.clock.Time())
680+
cr.registerMsgDrop(chain.ctx.IsBootstrapped())
680681
} else {
681-
cr.dropRateCalculator.Observe(0, cr.clock.Time())
682+
cr.registerMsgSuccess(chain.ctx.IsBootstrapped())
682683
}
683684
}
684685

@@ -776,6 +777,18 @@ func (cr *ChainRouter) HealthCheck() (interface{}, error) {
776777
return details, nil
777778
}
778779

780+
func (cr *ChainRouter) registerMsgDrop(isBootstrapped bool) {
781+
if isBootstrapped {
782+
cr.dropRateCalculator.Observe(1, cr.clock.Time())
783+
}
784+
}
785+
786+
func (cr *ChainRouter) registerMsgSuccess(isBootstrapped bool) {
787+
if isBootstrapped {
788+
cr.dropRateCalculator.Observe(0, cr.clock.Time())
789+
}
790+
}
791+
779792
func createRequestID(validatorID ids.ShortID, chainID ids.ID, requestID uint32) ids.ID {
780793
p := wrappers.Packer{Bytes: make([]byte, wrappers.IntLen)}
781794
p.PackInt(requestID)

0 commit comments

Comments
 (0)