mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-15 10:05:14 +00:00
abort route
This commit is contained in:
parent
e19f575229
commit
a5e8a69cd4
3 changed files with 127 additions and 15 deletions
|
|
@ -282,9 +282,20 @@ export class GatewayRuntime {
|
|||
|
||||
abortSession(sessionKey: string): boolean {
|
||||
const managedSession = this.sessions.get(sessionKey);
|
||||
if (!managedSession?.processing) {
|
||||
if (!managedSession) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const hadQueuedMessages = managedSession.queue.length > 0;
|
||||
if (hadQueuedMessages) {
|
||||
this.rejectQueuedMessages(managedSession, "Session aborted");
|
||||
this.emitState(managedSession);
|
||||
}
|
||||
|
||||
if (!managedSession.processing) {
|
||||
return hadQueuedMessages;
|
||||
}
|
||||
|
||||
void managedSession.session.abort().catch((error) => {
|
||||
this.emit(managedSession, {
|
||||
type: "error",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue