From e6e701a609c1fa166ec6eb511748723c39eb2137 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Fri, 20 Sep 2024 13:13:20 +0300 Subject: [PATCH] remove init and use Exec --- cmd/main.go | 2 +- internal/handlers/base.go | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 7176bd3..c03a8ef 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -96,7 +96,7 @@ func main() { en = en.WithDebug(nil) } - _, err = en.Init(ctx) + _, err = en.Exec(ctx, []byte{}) if err != nil { fmt.Fprintf(os.Stderr, "engine init exited with error: %v\n", err) os.Exit(1) diff --git a/internal/handlers/base.go b/internal/handlers/base.go index 9be5872..babd9fb 100644 --- a/internal/handlers/base.go +++ b/internal/handlers/base.go @@ -71,19 +71,7 @@ func(f *BaseSessionHandler) Process(rqs RequestSession) (RequestSession, error) } rqs.Engine = en - r, err = rqs.Engine.Init(rqs.Ctx) - 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) - } + r, err = rqs.Engine.Exec(rqs.Ctx, rqs.Input) if err != nil { perr := f.provider.Put(rqs.Config.SessionId, rqs.Storage) rqs.Storage = nil