implement missing context
This commit is contained in:
parent
37973a6c9b
commit
ddd8d7cac0
@ -80,7 +80,7 @@ func (hh *HTTPRequestHandler) ServeHTTP(w http.ResponseWriter, req *http.Request
|
||||
w.WriteHeader(200)
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
rqs, err = hh.Output(rqs)
|
||||
rqs, perr = hh.Reset(rqs)
|
||||
rqs, perr = hh.Reset(rqs.Ctx, rqs)
|
||||
if err != nil {
|
||||
hh.WriteError(w, 500, err)
|
||||
return
|
||||
|
@ -27,16 +27,16 @@ type RequestSession struct {
|
||||
|
||||
// TODO: seems like can remove this.
|
||||
type RequestParser interface {
|
||||
GetSessionId(ctx context.Context, rq any) (string, error)
|
||||
GetInput(rq any) ([]byte, error)
|
||||
GetSessionId(context.Context, any) (string, error)
|
||||
GetInput(any) ([]byte, error)
|
||||
}
|
||||
|
||||
type RequestHandler interface {
|
||||
GetConfig() engine.Config
|
||||
GetRequestParser() RequestParser
|
||||
GetEngine(cfg engine.Config, rs resource.Resource, pe *persist.Persister) engine.Engine
|
||||
Process(rs RequestSession) (RequestSession, error)
|
||||
Output(rs RequestSession) (RequestSession, error)
|
||||
Reset(rs RequestSession) (RequestSession, error)
|
||||
Shutdown()
|
||||
GetEngine(engine.Config, resource.Resource, *persist.Persister) engine.Engine
|
||||
Process(RequestSession) (RequestSession, error)
|
||||
Output(RequestSession) (RequestSession, error)
|
||||
Reset(context.Context, RequestSession) (RequestSession, error)
|
||||
Shutdown(ctx context.Context)
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ type Storage struct {
|
||||
UserdataDb db.Db
|
||||
}
|
||||
|
||||
func (s *Storage) Close(ctx context.Context) error {
|
||||
return s.UserdataDb.Close(ctx)
|
||||
}
|
||||
|
||||
type StorageProvider interface {
|
||||
Get(sessionId string) (*Storage, error)
|
||||
Put(sessionId string, storage *Storage) error
|
||||
@ -46,5 +50,5 @@ func (p *SimpleStorageProvider) Put(sessionId string, storage *Storage) error {
|
||||
}
|
||||
|
||||
func (p *SimpleStorageProvider) Close(ctx context.Context) error {
|
||||
return p.Storage.UserdataDb.Close(ctx)
|
||||
return p.Storage.Close(ctx)
|
||||
}
|
||||
|
@ -195,6 +195,7 @@ func (ms *MenuStorageService) ensureDbDir() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: how to handle persister here?
|
||||
func (ms *MenuStorageService) Close(ctx context.Context) error {
|
||||
errA := ms.stateStore.Close(ctx)
|
||||
errB := ms.userDataStore.Close(ctx)
|
||||
|
Loading…
Reference in New Issue
Block a user