Skip to content

Commit da2acaa

Browse files
authored
fix: start plugins in parallel (#787)
# Description Plugins should be started as soon as possible, arbitrary delay based off number of enabled plugins isn't helpful to getting metrics delayed from retina start. ## Related Issue If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request. ## Checklist - [ ] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [ ] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [ ] I have correctly attributed the author(s) of the code. - [ ] I have tested the changes locally. - [ ] I have followed the project's style guidelines. - [ ] I have updated the documentation, if necessary. - [ ] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed Please add any relevant screenshots or GIFs to showcase the changes made. ## Additional Notes Add any additional notes or context about the pull request here. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project.
1 parent a1a9825 commit da2acaa

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

pkg/managers/pluginmanager/pluginmanager.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ const (
2929
MAX_RECONCILE_TIME = 10 * time.Second
3030
)
3131

32-
const (
33-
MAX_STARTUP_TIME = 10 * time.Second
34-
)
35-
3632
var (
3733
ErrNilCfg = errors.New("pluginmanager requires a non-nil config")
3834
ErrZeroInterval = errors.New("pluginmanager requires a positive MetricsInterval in its config")
@@ -128,14 +124,6 @@ func (p *PluginManager) Reconcile(ctx context.Context, plugin api.Plugin) error
128124
// Note: This will block as long as main thread is running.
129125
func (p *PluginManager) Start(ctx context.Context) error {
130126
counter := p.tel.StartPerf("start-plugin-manager")
131-
// start plugins evenly throughout the interval,
132-
// if 2 plugins enabled, and 10 second interval
133-
// 10 / 2 = 5, then after every start sleep 5s
134-
// plugin 1 = 0s
135-
// plugin 2 = 5s
136-
// then the plugins won't awake at the same time and they'll have even execution time
137-
138-
delay := float32(MAX_STARTUP_TIME) / float32(len(p.plugins))
139127
p.l.Info("Starting plugin manager ...")
140128
var err error
141129

@@ -184,8 +172,6 @@ func (p *PluginManager) Start(ctx context.Context) error {
184172
p.l.Info(fmt.Sprintf("starting plugin %s", plug.Name()))
185173
return errors.Wrapf(plug.Start(ctx), "failed to start plugin %s", plug.Name())
186174
})
187-
188-
time.Sleep(time.Duration(delay))
189175
}
190176

191177
p.tel.StopPerf(counter)

0 commit comments

Comments
 (0)