Skip to content

Perf: add stateful CircuitBreaker #5512

@Aaronontheweb

Description

@Aaronontheweb

Should we consider adding a WithCircuitBreaker<TState,TResult> overload to the circuit breakers to get rid of an allocation here? (Pass this and message in, get vaue of readHighestSequenceNrFrom inside the function:)

var highSequenceNr = await _breaker.WithCircuitBreaker((this,message),(state) =>
                        ReadHighestSequenceNrAsync(message.PersistenceId, Math.Max(0L, message.FromSequenceNr - 1)));

That should? actually also get rid of one local on top of the closure allocation in question.

OTOH, this is the read side, which isn't as hot as the write side.

Originally posted by @to11mtm in #5505 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions