Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/domain/datastore/user_datastore_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,20 @@ export class UserDatastoreLoader {
return js;
} catch (bundleError) {
if (bundleExists) {
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
return await Deno.readTextFile(bundlePath);
try {
const cached = await Deno.readTextFile(bundlePath);
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
// Touch the cache mtime so subsequent loads see it as fresh,
// avoiding repeated failed rebundle attempts on every cold start.
try {
const now = new Date();
await Deno.utime(bundlePath, now, now);
} catch { /* ignore — worst case we retry next load */ }
return cached;
} catch {
// Cache file was removed between stat and read — treat as no cache.
}
}
throw bundleError;
}
Expand Down
17 changes: 14 additions & 3 deletions src/domain/drivers/user_driver_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,20 @@ export class UserDriverLoader {
return js;
} catch (bundleError) {
if (bundleExists) {
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
return await Deno.readTextFile(bundlePath);
try {
const cached = await Deno.readTextFile(bundlePath);
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
// Touch the cache mtime so subsequent loads see it as fresh,
// avoiding repeated failed rebundle attempts on every cold start.
try {
const now = new Date();
await Deno.utime(bundlePath, now, now);
} catch { /* ignore — worst case we retry next load */ }
return cached;
} catch {
// Cache file was removed between stat and read — treat as no cache.
}
}
throw bundleError;
}
Expand Down
17 changes: 14 additions & 3 deletions src/domain/models/user_model_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,20 @@ export class UserModelLoader {
return js;
} catch (bundleError) {
if (bundleExists) {
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
return await Deno.readTextFile(bundlePath);
try {
const cached = await Deno.readTextFile(bundlePath);
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
// Touch the cache mtime so subsequent loads see it as fresh,
// avoiding repeated failed rebundle attempts on every cold start.
try {
const now = new Date();
await Deno.utime(bundlePath, now, now);
} catch { /* ignore — worst case we retry next load */ }
return cached;
} catch {
// Cache file was removed between stat and read — treat as no cache.
}
}
throw bundleError;
}
Expand Down
17 changes: 14 additions & 3 deletions src/domain/vaults/user_vault_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,20 @@ export class UserVaultLoader {
return js;
} catch (bundleError) {
if (bundleExists) {
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
return await Deno.readTextFile(bundlePath);
try {
const cached = await Deno.readTextFile(bundlePath);
logger
.warn`Rebundle failed for ${relativePath}, using cached bundle: ${bundleError}`;
// Touch the cache mtime so subsequent loads see it as fresh,
// avoiding repeated failed rebundle attempts on every cold start.
try {
const now = new Date();
await Deno.utime(bundlePath, now, now);
} catch { /* ignore — worst case we retry next load */ }
return cached;
} catch {
// Cache file was removed between stat and read — treat as no cache.
}
}
throw bundleError;
}
Expand Down
Loading