MCPcopy Create free account
hub / github.com/Dhravya/notty / flushPendingSave

Method flushPendingSave

src/durable-objects/user-notes.ts:411–420  ·  view source on GitHub ↗
(noteId: string)

Source from the content-addressed store, hash-verified

409 "SELECT data FROM note_versions WHERE note_id = ? AND storage = 'r2'", noteId
410 ).toArray() as any[];
411 this.sql.exec("DELETE FROM note_versions WHERE note_id = ?", noteId);
412 this.sql.exec("DELETE FROM note_branches WHERE note_id = ?", noteId);
413 for (let i = 0; i < rows.length; i += 1000) {
414 const keys = rows.slice(i, i + 1000).map((r) => r.data as string);
415 try { await this.bucket.delete(keys); } catch (e) {
416 console.error(`Failed to delete version objects for note ${noteId}:`, e);
417 }
418 }
419 }
420
421 private contentHash(content: string): string {
422 let hash = 5381;
423 for (let i = 0; i < content.length; i++) {

Callers 1

webSocketCloseMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected