@ynhcj/xiaoyi 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime.js +10 -2
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -112,8 +112,15 @@ class XiaoYiRuntime {
|
|
|
112
112
|
console.log(`[TIMEOUT] Timeout disabled, skipping for session ${sessionId}`);
|
|
113
113
|
return undefined;
|
|
114
114
|
}
|
|
115
|
-
// Clear existing timeout if any
|
|
115
|
+
// Clear existing timeout AND timeout flag if any (reuse session scenario)
|
|
116
|
+
const hadExistingTimeout = this.sessionTimeoutMap.has(sessionId);
|
|
117
|
+
const hadSentTimeout = this.sessionTimeoutSent.has(sessionId);
|
|
116
118
|
this.clearSessionTimeout(sessionId);
|
|
119
|
+
// Also clear the timeout sent flag to allow this session to timeout again
|
|
120
|
+
if (hadSentTimeout) {
|
|
121
|
+
this.sessionTimeoutSent.delete(sessionId);
|
|
122
|
+
console.log(`[TIMEOUT] Previous timeout flag cleared for session ${sessionId} (session reuse)`);
|
|
123
|
+
}
|
|
117
124
|
const timeoutId = setTimeout(() => {
|
|
118
125
|
console.log(`[TIMEOUT] Timeout triggered for session ${sessionId}`);
|
|
119
126
|
this.sessionTimeoutMap.delete(sessionId);
|
|
@@ -121,7 +128,8 @@ class XiaoYiRuntime {
|
|
|
121
128
|
callback();
|
|
122
129
|
}, this.timeoutConfig.duration);
|
|
123
130
|
this.sessionTimeoutMap.set(sessionId, timeoutId);
|
|
124
|
-
|
|
131
|
+
const logSuffix = hadExistingTimeout ? " (replacing existing timeout)" : "";
|
|
132
|
+
console.log(`[TIMEOUT] ${this.timeoutConfig.duration}ms timeout started for session ${sessionId}${logSuffix}`);
|
|
125
133
|
return timeoutId;
|
|
126
134
|
}
|
|
127
135
|
/**
|