This commit is contained in:
Ice3man543 2021-10-27 18:41:39 +05:30
parent c16c93fe7c
commit df78ea72c5
2 changed files with 24 additions and 2 deletions

View File

@ -8,6 +8,30 @@ import (
"github.com/rs/xid" "github.com/rs/xid"
) )
// Execute takes a list of templates/workflows that have been compiled
// and executes them based on provided concurrency options.
//
// All the execution logic for the templates/workflows happens in this part
// of the engine.
func (e *Engine) Execute(templates []*templates.Template) {
finalTemplates, clusterCount := e.clusterTemplates(templates)
for _, template := range finalTemplates {
templateType := template.Type()
switch {
case template.SelfContained:
// Self Contained requests are executed here
case templateType == "workflow":
// Workflows requests are executed here
default:
// All other request types are executed here
}
}
}
// clusterTemplates performs identical http requests clustering for a list of templates // clusterTemplates performs identical http requests clustering for a list of templates
func (e *Engine) clusterTemplates(templatesList []*templates.Template) ([]*templates.Template, int) { func (e *Engine) clusterTemplates(templatesList []*templates.Template) ([]*templates.Template, int) {
if e.options.OfflineHTTP { if e.options.OfflineHTTP {

View File

@ -30,8 +30,6 @@ func NewWorkPool(config WorkPoolConfig) *WorkPool {
return &WorkPool{config: config} return &WorkPool{config: config}
} }
// TODO: port these invocations of waitgroups and input logic into a generic
// workpool type functionality.
func (w *WorkPool) Execute(templates []*templates.Template) { func (w *WorkPool) Execute(templates []*templates.Template) {
} }