mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
added context for runnerpool interface (#1320)
* added context for runnerpool interface * added context for runnerpool interface
This commit is contained in:
@@ -40,7 +40,7 @@ func (p *chPlacer) PlaceCall(ctx context.Context, rp RunnerPool, call RunnerCall
|
||||
var runnerPoolErr error
|
||||
for {
|
||||
var runners []Runner
|
||||
runners, runnerPoolErr = rp.Runners(call)
|
||||
runners, runnerPoolErr = rp.Runners(ctx, call)
|
||||
|
||||
i := int(jumpConsistentHash(sum64, int32(len(runners))))
|
||||
for j := 0; j < len(runners) && !state.IsDone(); j++ {
|
||||
|
||||
@@ -34,7 +34,7 @@ func (sp *naivePlacer) PlaceCall(ctx context.Context, rp RunnerPool, call Runner
|
||||
var runnerPoolErr error
|
||||
for {
|
||||
var runners []Runner
|
||||
runners, runnerPoolErr = rp.Runners(call)
|
||||
runners, runnerPoolErr = rp.Runners(ctx, call)
|
||||
|
||||
for j := 0; j < len(runners) && !state.IsDone(); j++ {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ type Placer interface {
|
||||
// RunnerPool is the abstraction for getting an ordered list of runners to try for a call
|
||||
type RunnerPool interface {
|
||||
// returns an error for unrecoverable errors that should not be retried
|
||||
Runners(call RunnerCall) ([]Runner, error)
|
||||
Runners(ctx context.Context, call RunnerCall) ([]Runner, error)
|
||||
Shutdown(ctx context.Context) error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user