add replay flow
This commit is contained in:
parent
b08c12dfbe
commit
02aa8c58f8
|
@ -13,17 +13,20 @@ import (
|
||||||
"infini.sh/framework/core/global"
|
"infini.sh/framework/core/global"
|
||||||
"infini.sh/framework/core/module"
|
"infini.sh/framework/core/module"
|
||||||
"infini.sh/framework/core/orm"
|
"infini.sh/framework/core/orm"
|
||||||
|
"infini.sh/framework/core/pipeline"
|
||||||
"infini.sh/framework/core/util"
|
"infini.sh/framework/core/util"
|
||||||
elastic2 "infini.sh/framework/modules/elastic"
|
elastic2 "infini.sh/framework/modules/elastic"
|
||||||
elastic1 "infini.sh/framework/modules/elastic/common"
|
elastic1 "infini.sh/framework/modules/elastic/common"
|
||||||
elastic3 "infini.sh/framework/modules/elastic/api"
|
elastic3 "infini.sh/framework/modules/elastic/api"
|
||||||
"infini.sh/framework/modules/security"
|
"infini.sh/framework/modules/security"
|
||||||
|
"infini.sh/framework/plugins/replay"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
uri2 "net/url"
|
uri2 "net/url"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"github.com/valyala/fasttemplate"
|
"github.com/valyala/fasttemplate"
|
||||||
|
log "github.com/cihub/seelog"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -339,7 +342,6 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
||||||
//处理生命周期
|
//处理生命周期
|
||||||
//TEMPLATE_NAME
|
//TEMPLATE_NAME
|
||||||
//INDEX_PREFIX
|
//INDEX_PREFIX
|
||||||
|
|
||||||
dslTplFile:=path.Join(global.Env().GetConfigDir(),"initialization.tpl")
|
dslTplFile:=path.Join(global.Env().GetConfigDir(),"initialization.tpl")
|
||||||
dslFile:=path.Join(global.Env().GetConfigDir(),"initialization.dsl")
|
dslFile:=path.Join(global.Env().GetConfigDir(),"initialization.dsl")
|
||||||
|
|
||||||
|
@ -349,6 +351,7 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dslWriteSuccess=false
|
||||||
if len(dsl)>0{
|
if len(dsl)>0{
|
||||||
var tpl *fasttemplate.Template
|
var tpl *fasttemplate.Template
|
||||||
tpl,err=fasttemplate.NewTemplate(string(dsl), "$[[", "]]")
|
tpl,err=fasttemplate.NewTemplate(string(dsl), "$[[", "]]")
|
||||||
|
@ -369,6 +372,15 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
||||||
if err!=nil{
|
if err!=nil{
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
dslWriteSuccess=true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if dslWriteSuccess{
|
||||||
|
lines := util.FileGetLines(dslFile)
|
||||||
|
_,err,_:=replay.ReplayLines(pipeline.AcquireContext(),lines,cfg.Schema,cfg.Host)
|
||||||
|
if err!=nil{
|
||||||
|
log.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue