fix(msteams): clear pending upload timeout on removal#32555
fix(msteams): clear pending upload timeout on removal#32555BradGroux merged 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes orphaned One small gap remains: the manual-expiry branch inside Confidence Score: 4/5
Last reviewed commit: 38d9f2b |
Additional Comments (1)
When To keep the cleanup uniform — and to prevent Prompt To Fix With AIThis is a comment left during a code review.
Path: extensions/msteams/src/pending-uploads.ts
Line: 63-66
Comment:
**Timeout not cancelled on manual expiry**
When `getPendingUpload` detects an expired entry and removes it from `pendingUploads`, it does not cancel the corresponding timeout or remove it from `pendingTimeouts`. This means a live timer handle stays in `pendingTimeouts` until the timeout eventually fires on its own. While the timer's callback is safe (it calls `pendingUploads.delete` and `pendingTimeouts.delete` on an already-absent entry), it is inconsistent with the rest of the PR, which explicitly cancels timers on all other removal paths.
To keep the cleanup uniform — and to prevent `clearPendingUploads` from iterating over a timer that is about to self-fire — consider cancelling and removing the timeout here as well:
```suggestion
if (Date.now() - entry.createdAt > PENDING_UPLOAD_TTL_MS) {
pendingUploads.delete(id);
const timeout = pendingTimeouts.get(id);
if (timeout) {
clearTimeout(timeout);
pendingTimeouts.delete(id);
}
return undefined;
}
```
How can I resolve this? If you propose a fix, please make it concise. |
38d9f2b to
69eeab0
Compare
Track setTimeout handles in a separate map and clear them when uploads are removed or the store is cleared, preventing orphaned timer callbacks. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
69eeab0 to
7afb37b
Compare
|
Hi @PinoHouse — thanks for the submission. I’m the new Microsoft Teams maintainer for OpenClaw. Please give me a day or two to work through the open Teams backlog. Also, join the Twitter community for daily MS Teams feedback + updates: https://x.com/i/communities/2031170403607974228 |
1 similar comment
|
Hi @PinoHouse — thanks for the submission. I’m the new Microsoft Teams maintainer for OpenClaw. Please give me a day or two to work through the open Teams backlog. Also, join the Twitter community for daily MS Teams feedback + updates: https://x.com/i/communities/2031170403607974228 |
|
I took a pass through this one. The fix is nicely scoped and the main paths look right: timeout handles are now tracked and cleared on explicit removal and bulk clear, which addresses the orphaned-callback issue this PR is targeting. One small gap I’d call out before merge: I also don’t see any test changes in this PR, so a small unit test around timer cleanup / manual expiry would be a good way to lock this behavior down. If you update that manual-expiry branch to clear the timeout as well, this looks ready to me. |
Track setTimeout handles and clear them on removal/bulk-clear to prevent orphaned timer callbacks.