mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat(hub): add ServerChan task notifications (#515)
* fix(hub): 修复发送后状态显示延迟 * feat(hub): 接入Server酱任务通知 * fix(hub): 仅在会话结束时发送完成通知 * fix(hub): avoid reviving inactive queued sessions * fix(hub): address notification review feedback * fix(hub): expire queued thinking on hub clock * fix(hub): 修复任务通知 review 反馈
This commit is contained in:
@@ -214,8 +214,13 @@ export class SyncEngine {
|
||||
this.triggerDedupIfNeeded(payload.sid)
|
||||
}
|
||||
|
||||
handleSessionEnd(payload: { sid: string; time: number }): void {
|
||||
handleSessionEnd(payload: { sid: string; time: number; reason?: 'completed' | 'terminated' | 'error' }): void {
|
||||
this.sessionCache.handleSessionEnd(payload)
|
||||
this.eventPublisher.emit({
|
||||
type: 'session-ended',
|
||||
sessionId: payload.sid,
|
||||
reason: payload.reason
|
||||
})
|
||||
// Retry dedup now that this session is inactive — a prior dedup may have
|
||||
// skipped it because it was still active at the time.
|
||||
this.triggerDedupIfNeeded(payload.sid)
|
||||
@@ -285,6 +290,7 @@ export class SyncEngine {
|
||||
}
|
||||
): Promise<void> {
|
||||
await this.messageService.sendMessage(sessionId, payload)
|
||||
this.sessionCache.markMessageQueued(sessionId)
|
||||
}
|
||||
|
||||
async approvePermission(
|
||||
|
||||
Reference in New Issue
Block a user