drop session in httphandler.
@@ -20,6 +20,7 @@ use poem::RequestBody;
use poem::Result as PoemResult;
use crate::sessions::Session;
+use crate::sessions::SessionManager;
use crate::sessions::SessionType;
pub struct HttpQueryContext {
@@ -37,6 +38,12 @@ impl HttpQueryContext {
}
}
+impl Drop for HttpQueryContext {
+ fn drop(&mut self) {
+ SessionManager::instance().destroy_session(&self.session.get_id())
+ }
+}
+
#[async_trait::async_trait]
impl<'a> FromRequest<'a> for &'a HttpQueryContext {
async fn from_request(req: &'a Request, _body: &mut RequestBody) -> PoemResult<Self> {
