mirror of
https://github.com/actions-runner-controller/actions-runner-controller.git
synced 2026-10-03 08:46:08 +02:00
Improve performance of controllers
This commit is contained in:
@@ -71,6 +71,13 @@ func WithRemoveRunner(err error) ClientOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithRemoveRunnerFunc configures a function to handle RemoveRunner calls dynamically.
|
||||
func WithRemoveRunnerFunc(fn func(context.Context, int64) error) ClientOption {
|
||||
return func(c *Client) {
|
||||
c.removeRunnerFunc = fn
|
||||
}
|
||||
}
|
||||
|
||||
// WithGenerateJitRunnerConfig configures the result of GenerateJitRunnerConfig
|
||||
func WithGenerateJitRunnerConfig(result *scaleset.RunnerScaleSetJitRunnerConfig, err error) ClientOption {
|
||||
return func(c *Client) {
|
||||
@@ -121,6 +128,7 @@ type Client struct {
|
||||
systemInfo scaleset.SystemInfo
|
||||
createRunnerScaleSetFunc func(context.Context, *scaleset.RunnerScaleSet) (*scaleset.RunnerScaleSet, error)
|
||||
updateRunnerScaleSetFunc func(context.Context, int, *scaleset.RunnerScaleSet) (*scaleset.RunnerScaleSet, error)
|
||||
removeRunnerFunc func(context.Context, int64) error
|
||||
|
||||
getRunnerScaleSetResult struct {
|
||||
*scaleset.RunnerScaleSet
|
||||
@@ -204,6 +212,9 @@ func (c *Client) GetRunnerByName(ctx context.Context, runnerName string) (*scale
|
||||
}
|
||||
|
||||
func (c *Client) RemoveRunner(ctx context.Context, runnerID int64) error {
|
||||
if c.removeRunnerFunc != nil {
|
||||
return c.removeRunnerFunc(ctx, runnerID)
|
||||
}
|
||||
return c.removeRunnerResult.err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user