Skip to content

Commit

Permalink
Set buffer options if they have been created in the module init secti…
Browse files Browse the repository at this point in the history
…on (e.g. extra_buffers) (#366)
  • Loading branch information
asmaloney authored Aug 7, 2023
1 parent 382f73d commit 121ed3d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions amod/amod.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ func setModuleParams(module modules.Interface, log *issueLog, fields []*field) {
if buffer != nil {
setBufferParams(moduleName, buffer, log, field)
} else {
// save our current buffers so we can determine if any have been created in SetParam
saveBufferList := module.Buffers()

err := module.SetParam(kv)

if err != nil {
Expand All @@ -347,6 +350,16 @@ func setModuleParams(module modules.Interface, log *issueLog, fields []*field) {
continue
}
}

// check if we created any buffers through the params (e.g. extra_buffers) and set their params
newBufferList := module.Buffers()

if len(saveBufferList) != len(newBufferList) {
newBuffers := newBufferList[len(saveBufferList):]
for _, buffer := range newBuffers {
setBufferParams(moduleName, buffer, log, field)
}
}
}
}
}
Expand Down

0 comments on commit 121ed3d

Please sign in to comment.