My second mistake on redis session db because I'm not personally use redis, so I'm waiting for redis users to find these type of errors inside it, such as @sy264115809


Former-commit-id: df84348df7509c0f863f41f01de6ed6db6e8133e
This commit is contained in:
kataras 2017-08-21 20:59:54 +03:00
parent 40f79c1f19
commit 3ec5ff58c9

View File

@ -54,14 +54,19 @@ func (db *Database) Load(sid string) (storeDB sessions.RemoteStore) {
return
}
storeDB, ok := storeMaybe.(sessions.RemoteStore)
storeB, ok := storeMaybe.([]byte)
if !ok {
golog.Errorf(`error while trying to load session values(%s) from redis:
the retrieved value is not a sessions.RemoteStore type, please report that as bug, it should never occur`,
sid)
golog.Errorf("something wrong, store should be stored as []byte but stored as %#v", storeMaybe)
return
}
storeDB, err = sessions.DecodeRemoteStore(storeB) // decode the whole value, as a remote store
if err != nil {
golog.Errorf(`error while trying to load session values(%s) from redis:
the retrieved value is not a sessions.RemoteStore type, please report that as bug, that should never occur`,
sid)
}
return
}