MCPcopy Create free account
hub / github.com/Noumena-Network/code / scheduleDrain

Method scheduleDrain

src/utils/sessionStorage.ts:656–677  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

654 }
655
656 private scheduleDrain(): void {
657 if (this.flushTimer) {
658 return
659 }
660 this.flushTimer = setTimeout(async () => {
661 this.flushTimer = null
662 try {
663 this.activeDrain = this.drainWriteQueue()
664 await this.activeDrain
665 } catch (error) {
666 if (!this.disablePersistenceForError(error, 'session write queue')) {
667 logError(error)
668 }
669 } finally {
670 this.activeDrain = null
671 // If more items arrived during drain, schedule again
672 if (this.writeQueues.size > 0) {
673 this.scheduleDrain()
674 }
675 }
676 }, this.FLUSH_INTERVAL_MS)
677 }
678
679 private disablePersistenceForError(error: unknown, context: string): boolean {
680 if (!isFsInaccessible(error)) {

Callers 1

enqueueWriteMethod · 0.95

Calls 3

drainWriteQueueMethod · 0.95
logErrorFunction · 0.70

Tested by

no test coverage detected