Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: share the Apple Health day-write queue between JSON ingest and XML import (#8449)
[._.]/ Adam Eivy1232703749a2
diff --git a/server/services/appleHealthIngest.js b/server/services/appleHealthIngest.jsindex 43fdd15b54..d99bc68de4 100644--- a/server/services/appleHealthIngest.js+++ b/server/services/appleHealthIngest.js@@ -14,9 +14,10 @@ import { createKeyedFileWriteQueue } from '../lib/fileWriteQueue.js';/*** Per-date write queue to serialize read-modify-write cycles.* Keyed by date string (YYYY-MM-DD) so different days fan out in parallel- * while writes to the same day serialize.+ * while writes to the same day serialize. Shared with the XML importer so a+ * JSON ingest and an XML import can never interleave on the same day file.*/-const queueDayWrite = createKeyedFileWriteQueue();+export const queueDayWrite = createKeyedFileWriteQueue();// === Pure Functions ===diff --git a/server/services/appleHealthXml.js b/server/services/appleHealthXml.jsindex f02619796f..9a244b96ab 100644--- a/server/services/appleHealthXml.js+++ b/server/services/appleHealthXml.js@@ -8,9 +8,8 @@import { createReadStream } from 'fs';import { unlink } from 'fs/promises';-import { extractDateStr, readDayFile, writeDayFile, upsertPoints } from './appleHealthIngest.js';+import { extractDateStr, readDayFile, writeDayFile, upsertPoints, queueDayWrite } from './appleHealthIngest.js';import { createAppleHealthRecordStream } from './appleHealthXmlParser.js';-import { createKeyedFileWriteQueue } from '../lib/fileWriteQueue.js';// === Mapping Tables ===@@ -206,13 +205,6 @@ function aggregateSleepAnalysis(points) {const FLUSH_INTERVAL = 200000; // Flush to disk every 200K records to stay under memory limits-/**- * Per-date write queue to serialize read-modify-write cycles.- * Keyed by date string (YYYY-MM-DD) so different days fan out in parallel- * while writes to the same day serialize.- */-const queueDayWrite = createKeyedFileWriteQueue();-/*** Flush accumulated day buckets to disk: aggregate, merge with existing, write, clear.* Uses upsert to handle re-imports that update existing day totals.