* 清理过期的会话
()
| 359 | * 清理过期的会话 |
| 360 | */ |
| 361 | async cleanExpiredSessions() { |
| 362 | try { |
| 363 | const result = await this.run( |
| 364 | 'DELETE FROM sessions WHERE expire < ?', |
| 365 | [new Date().toISOString()] |
| 366 | ); |
| 367 | if (result.changes > 0) { |
| 368 | logger.info(`清理了 ${result.changes} 个过期会话`); |
| 369 | } |
| 370 | } catch (error) { |
| 371 | logger.error('清理过期会话失败:', error); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | /** |
| 376 | * 创建默认菜单项 |
no test coverage detected