-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(ACS-175): Resolve integrations freeze and improve rate limit handling #839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b03e446
b20c1bb
27ae640
56a6bed
a37e072
f9fdd8d
8328066
da9b707
e033f51
0f1a7ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,9 +153,51 @@ export function setupPtyHandlers( | |
|
|
||
| /** | ||
| * Write data to a PTY process | ||
| * Uses setImmediate to prevent blocking the event loop on large writes | ||
| */ | ||
| export function writeToPty(terminal: TerminalProcess, data: string): void { | ||
| terminal.pty.write(data); | ||
| console.log('[PtyManager:writeToPty] About to write to pty, data length:', data.length); | ||
|
||
|
|
||
| // For large commands, write in chunks to prevent blocking | ||
| if (data.length > 1000) { | ||
| console.log('[PtyManager:writeToPty] Large write detected, using chunked write'); | ||
| const chunkSize = 100; // Smaller chunks | ||
|
||
| let offset = 0; | ||
| let chunkNum = 0; | ||
|
|
||
| const writeChunk = () => { | ||
|
||
| if (offset >= data.length) { | ||
| console.log('[PtyManager:writeToPty] Chunked write completed, total chunks:', chunkNum); | ||
| return; | ||
| } | ||
|
|
||
| const chunk = data.slice(offset, offset + chunkSize); | ||
| chunkNum++; | ||
| console.log('[PtyManager:writeToPty] Writing chunk', chunkNum, 'offset:', offset, 'size:', chunk.length); | ||
| try { | ||
| terminal.pty.write(chunk); | ||
| console.log('[PtyManager:writeToPty] Chunk', chunkNum, 'written'); | ||
| offset += chunkSize; | ||
| // Use setImmediate to yield to the event loop between chunks | ||
| setImmediate(writeChunk); | ||
| } catch (error) { | ||
| console.error('[PtyManager:writeToPty] Chunked write FAILED at chunk', chunkNum, 'offset', offset, ':', error); | ||
| } | ||
| }; | ||
|
|
||
| // Start the chunked write after yielding | ||
| console.log('[PtyManager:writeToPty] Scheduling first chunk...'); | ||
| setImmediate(writeChunk); | ||
| console.log('[PtyManager:writeToPty] First chunk scheduled, returning'); | ||
| } else { | ||
| try { | ||
| terminal.pty.write(data); | ||
| console.log('[PtyManager:writeToPty] Write completed successfully'); | ||
| } catch (error) { | ||
| console.error('[PtyManager:writeToPty] Write FAILED:', error); | ||
| throw error; | ||
| } | ||
|
||
| } | ||
|
||
| } | ||
|
||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,9 +120,14 @@ export class TerminalManager { | |
| * Send input to a terminal | ||
| */ | ||
| write(id: string, data: string): void { | ||
| console.log('[TerminalManager:write] Writing to terminal:', id, 'data length:', data.length); | ||
|
||
| const terminal = this.terminals.get(id); | ||
| if (terminal) { | ||
| console.log('[TerminalManager:write] Terminal found, calling writeToPty...'); | ||
| PtyManager.writeToPty(terminal, data); | ||
| console.log('[TerminalManager:write] writeToPty completed'); | ||
| } else { | ||
| console.error('[TerminalManager:write] Terminal NOT found:', id); | ||
| } | ||
|
||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A large number of
console.logandconsole.errorstatements have been added throughout this file for debugging (e.g., here and on lines 317, 319, 322, 325, 341, 350, 352, 363, 365, 369, 372, 396, 397, 401, 403, 407, 417, 426). These should be removed before merging to keep production logs clean. If some logging is desired, please use the existingdebugLoganddebugErrorutilities.