Skip to content

Commit d42e79b

Browse files
committed
plugins/bundle: prevent ns-level polling by validating intervals
Fix polling interval validation in Reconfigure to avoid nanosecond ticker loops Fixes: #8081 Signed-off-by: jjhwan.h <[email protected]>
1 parent 76091fd commit d42e79b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

v1/plugins/bundle/plugin.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,15 @@ func (p *Plugin) Reconfigure(ctx context.Context, config any) {
158158
// Look for any bundles that have had their config changed, are new, or have been removed
159159
newConfig := config.(*Config)
160160
newBundles, updatedBundles, deletedBundles := p.configDelta(newConfig)
161-
p.config = *newConfig
162161

162+
err := newConfig.ValidateAndInjectDefaults()
163+
if err != nil {
164+
p.manager.Logger().Error("Failed to validate bundle configuration: %s", err)
165+
p.cfgMtx.Unlock()
166+
return
167+
}
168+
169+
p.config = *newConfig
163170
p.cfgMtx.Unlock()
164171

165172
if len(updatedBundles) == 0 && len(newBundles) == 0 && len(deletedBundles) == 0 {
@@ -194,7 +201,7 @@ func (p *Plugin) Reconfigure(ctx context.Context, config any) {
194201
// Deactivate the bundles that were removed
195202
params := storage.WriteParams
196203
params.Context = storage.NewContext() // TODO(sr): metrics?
197-
err := storage.Txn(ctx, p.manager.Store, params, func(txn storage.Transaction) error {
204+
err = storage.Txn(ctx, p.manager.Store, params, func(txn storage.Transaction) error {
198205
opts := &bundle.DeactivateOpts{
199206
Ctx: ctx,
200207
Store: p.manager.Store,

0 commit comments

Comments
 (0)