|
@@ -47,7 +47,6 @@ func NewSession(
|
|
|
invoke_from access_types.PluginAccessType,
|
|
|
action access_types.PluginAccessAction,
|
|
|
declaration *plugin_entities.PluginDeclaration,
|
|
|
- persistence *persistence.Persistence,
|
|
|
) *Session {
|
|
|
s := &Session{
|
|
|
ID: uuid.New().String(),
|
|
@@ -58,7 +57,6 @@ func NewSession(
|
|
|
InvokeFrom: invoke_from,
|
|
|
Action: action,
|
|
|
Declaration: declaration,
|
|
|
- persistence: persistence,
|
|
|
}
|
|
|
|
|
|
session_lock.Lock()
|
|
@@ -74,9 +72,20 @@ func NewSession(
|
|
|
|
|
|
func GetSession(id string) *Session {
|
|
|
session_lock.RLock()
|
|
|
- defer session_lock.RUnlock()
|
|
|
+ session := sessions[id]
|
|
|
+ session_lock.RUnlock()
|
|
|
+
|
|
|
+ if session == nil {
|
|
|
+ // if session not found, it may be generated by another node, try to get it from cache
|
|
|
+ session, err := cache.Get[Session](sessionKey(id))
|
|
|
+ if err != nil {
|
|
|
+ log.Error("get session info from cache failed, %s", err)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return session
|
|
|
+ }
|
|
|
|
|
|
- return sessions[id]
|
|
|
+ return session
|
|
|
}
|
|
|
|
|
|
func DeleteSession(id string) {
|
|
@@ -101,10 +110,6 @@ func (s *Session) Runtime() plugin_entities.PluginRuntimeInterface {
|
|
|
return s.runtime
|
|
|
}
|
|
|
|
|
|
-func (s *Session) Storage() *persistence.Persistence {
|
|
|
- return s.persistence
|
|
|
-}
|
|
|
-
|
|
|
type PLUGIN_IN_STREAM_EVENT string
|
|
|
|
|
|
const (
|