Merge pull request 'Clear persister from handler in outer code aswell' (#200) from lash/persister-freakout into master

Reviewed-on: urdt/ussd#200
This commit is contained in:
lash 2024-12-03 17:18:11 +01:00
commit e56138e416
2 changed files with 8 additions and 1 deletions

View File

@ -55,6 +55,9 @@ func(f *BaseSessionHandler) Process(rqs RequestSession) (RequestSession, error)
}
f.hn = f.hn.WithPersister(rqs.Storage.Persister)
defer func() {
f.hn.Exit()
}()
eni := f.GetEngine(rqs.Config, f.rs, rqs.Storage.Persister)
en, ok := eni.(*engine.DefaultEngine)
if !ok {

View File

@ -113,7 +113,7 @@ func (h *Handlers) Init(ctx context.Context, sym string, input []byte) (resource
return r, nil
}
defer func() {
h.pe = nil
h.Exit()
}()
h.st = h.pe.GetState()
@ -140,6 +140,10 @@ func (h *Handlers) Init(ctx context.Context, sym string, input []byte) (resource
return r, nil
}
func (h *Handlers) Exit() {
h.pe = nil
}
// SetLanguage sets the language across the menu
func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result