mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-08 10:27:08 +02:00
refactor(artwork): drop the unreachable breaker branch from the tracing gate
--live wires the tracing gate straight to passthroughGate, so errBreakerOpen can never reach it; the test only passed by injecting a fake gate.
This commit is contained in:
parent
b276e8aceb
commit
cf2b4df36b
3 changed files with 2 additions and 12 deletions
|
|
@ -402,6 +402,8 @@ type Resolver struct {
|
|||
func NewTracingResolver(ds model.DataStore, ag *agents.Agents, ffm ffmpeg.FFmpeg, t *ChainTrace, live bool) *Resolver {
|
||||
gate := offlineGate(t)
|
||||
if live {
|
||||
// A diagnostic must show the provider's real answer, and one item is at most one call
|
||||
// per agent, so --live deliberately bypasses the rate limiter and circuit breaker.
|
||||
gate = tracingGate(t, passthroughGate)
|
||||
}
|
||||
return &Resolver{inner: newResolver(ds, ag, ffm, gate), trace: t}
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ func tracingGate(t *chainTrace, inner gateFunc) gateFunc {
|
|||
switch {
|
||||
case r != nil:
|
||||
t.add(traceStep{Candidate: candidate, Outcome: OutcomeHit, Detail: path})
|
||||
case errors.Is(err, errBreakerOpen):
|
||||
t.add(traceStep{Candidate: candidate, Outcome: OutcomeSkipped, Detail: "circuit breaker open"})
|
||||
case isTransientExternal(err):
|
||||
t.add(traceStep{Candidate: candidate, Outcome: OutcomeError, Detail: err.Error()})
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -158,16 +158,6 @@ var _ = Describe("external gate tracing", func() {
|
|||
Expect(t.Steps()[0].Detail).To(ContainSubstring("429"))
|
||||
})
|
||||
|
||||
It("records skipped when the breaker is open", func() {
|
||||
t := &chainTrace{}
|
||||
open := func(string, func() (io.ReadCloser, string, error)) (io.ReadCloser, string, error) {
|
||||
return nil, "", errBreakerOpen
|
||||
}
|
||||
_, _, _ = tracingGate(t, open)("apple-music", hit)
|
||||
Expect(t.Steps()[0].Outcome).To(Equal(OutcomeSkipped))
|
||||
Expect(t.Steps()[0].Detail).To(ContainSubstring("circuit breaker"))
|
||||
})
|
||||
|
||||
It("never calls the agent in offline mode", func() {
|
||||
t := &chainTrace{}
|
||||
called := false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue