Improve attachment memory safety, downloads, and high-memory alert UX.
Queue Release Build / prepare (push) Successful in 20s
Deploy Web Apps / deploy (push) Successful in 9m2s
Queue Release Build / build-windows (push) Successful in 28m8s
Queue Release Build / build-linux (push) Successful in 47m26s
Queue Release Build / build-android (push) Successful in 19m52s
Queue Release Build / finalize (push) Successful in 4m42s
Queue Release Build / prepare (push) Successful in 20s
Deploy Web Apps / deploy (push) Successful in 9m2s
Queue Release Build / build-windows (push) Successful in 28m8s
Queue Release Build / build-linux (push) Successful in 47m26s
Queue Release Build / build-android (push) Successful in 19m52s
Queue Release Build / finalize (push) Successful in 4m42s
Stream large receives to disk with chunk acks to cap renderer RAM, evict off-screen display blobs, and route exports through a disk-aware download service. Fix the high-memory dialog (backdrop dismiss, copy, log actions), allow diagnostics paths in the path jail, and restore persisted image hydration after reload. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,7 @@ export class AttachmentRuntimeStore {
|
||||
private pendingRequests = new Map<string, Set<string>>();
|
||||
private chunkBuffers = new Map<string, (ArrayBuffer | undefined)[]>();
|
||||
private chunkCounts = new Map<string, number>();
|
||||
private announcedHostsByAttachment = new Map<string, Set<string>>();
|
||||
|
||||
touch(): void {
|
||||
this.updated.set(this.updated() + 1);
|
||||
@@ -66,6 +67,25 @@ export class AttachmentRuntimeStore {
|
||||
return this.originalFiles.get(key);
|
||||
}
|
||||
|
||||
deleteOriginalFile(key: string): void {
|
||||
this.originalFiles.delete(key);
|
||||
}
|
||||
|
||||
addAnnouncedHost(requestKey: string, peerId: string): void {
|
||||
const hosts = this.announcedHostsByAttachment.get(requestKey) ?? new Set<string>();
|
||||
|
||||
hosts.add(peerId);
|
||||
this.announcedHostsByAttachment.set(requestKey, hosts);
|
||||
}
|
||||
|
||||
getAnnouncedHosts(requestKey: string): Set<string> {
|
||||
return this.announcedHostsByAttachment.get(requestKey) ?? new Set();
|
||||
}
|
||||
|
||||
deleteAnnouncedHosts(requestKey: string): void {
|
||||
this.announcedHostsByAttachment.delete(requestKey);
|
||||
}
|
||||
|
||||
findOriginalFileByFileId(fileId: string): File | null {
|
||||
for (const [key, file] of this.originalFiles) {
|
||||
if (key.endsWith(`:${fileId}`)) {
|
||||
@@ -160,5 +180,11 @@ export class AttachmentRuntimeStore {
|
||||
this.cancelledTransfers.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
for (const key of Array.from(this.announcedHostsByAttachment.keys())) {
|
||||
if (key.startsWith(scopedPrefix)) {
|
||||
this.announcedHostsByAttachment.delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user