Adds extension points for runner pools in load-balanced mode (Patch 1/2) (#851)

* adds extension points for runner pools in load-balanced mode

* adds error to return values in RunnerPool and Runner interfaces
This commit is contained in:
Gerardo Viedma
2018-03-15 10:28:56 +00:00
committed by GitHub
parent 7df6863678
commit 6bc1220d8b
3 changed files with 41 additions and 0 deletions

View File

@@ -113,6 +113,7 @@ type Server struct {
rootMiddlewares []fnext.Middleware
apiMiddlewares []fnext.Middleware
promExporter *prometheus.Exporter
runnerPool models.RunnerPool
// Extensions can append to this list of contexts so that cancellations are properly handled.
extraCtxs []context.Context
}
@@ -842,6 +843,12 @@ func (s *Server) Datastore() models.Datastore {
return s.datastore
}
// WithRunnerPool provides an extension point for overriding
// the default runner pool implementation when running in load-balanced mode
func (s *Server) WithRunnerPool(runnerPool models.RunnerPool) {
s.runnerPool = runnerPool
}
// returns the unescaped ?cursor and ?perPage values
// pageParams clamps 0 < ?perPage <= 100 and defaults to 30 if 0
// ignores parsing errors and falls back to defaults.