remove init and use Exec

This commit is contained in:
Alfred Kamanda 2024-09-20 13:13:20 +03:00 committed by Carlosokumu
parent 59a072a340
commit 772d33ca29
Signed by untrusted user: carlos
GPG Key ID: 7BD6BC8160A5C953
2 changed files with 2 additions and 14 deletions

View File

@ -96,7 +96,7 @@ func main() {
en = en.WithDebug(nil) en = en.WithDebug(nil)
} }
_, err = en.Init(ctx) _, err = en.Exec(ctx, []byte{})
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "engine init exited with error: %v\n", err) fmt.Fprintf(os.Stderr, "engine init exited with error: %v\n", err)
os.Exit(1) os.Exit(1)

View File

@ -71,19 +71,7 @@ func(f *BaseSessionHandler) Process(rqs RequestSession) (RequestSession, error)
} }
rqs.Engine = en rqs.Engine = en
r, err = rqs.Engine.Init(rqs.Ctx) r, err = rqs.Engine.Exec(rqs.Ctx, rqs.Input)
if err != nil {
perr := f.provider.Put(rqs.Config.SessionId, rqs.Storage)
rqs.Storage = nil
if perr != nil {
logg.ErrorCtxf(rqs.Ctx, "", "storage put error", perr)
}
return rqs, err
}
if r && len(rqs.Input) > 0 {
r, err = rqs.Engine.Exec(rqs.Ctx, rqs.Input)
}
if err != nil { if err != nil {
perr := f.provider.Put(rqs.Config.SessionId, rqs.Storage) perr := f.provider.Put(rqs.Config.SessionId, rqs.Storage)
rqs.Storage = nil rqs.Storage = nil