feat(metadata): skip models on offline roots during bulk fetch (#1108)

Bulk metadata refresh picked candidates purely from cache state, so the
entries the scoped scan deliberately keeps for unreachable drives were
fetched anyway — burning CivitAI rate limit on sidecar/preview writes
that cannot land.

- Filter the fetch queue by root reachability (live check via
  describe_model_roots), covering both startup-offline and mid-session
  drive-off; probing failures degrade to no filtering
- Report offline_skipped / offline_roots in the WS terminal payloads,
  the HTTP result and the completion message
- Show a "Drive Offline" stat card in the fetch summary modal when
  any model was skipped this way
This commit is contained in:
Will Miao
2026-10-08 07:47:54 +08:00
parent 842ffb1df8
commit 3468686e5f
14 changed files with 243 additions and 6 deletions
+10 -1
View File
@@ -898,7 +898,9 @@ export class BaseModelApiClient {
}
_showFailureDetailsModal(data) {
const { failures = [], success, processed, total, failure_count, skipped_count, elapsed_seconds } = data;
const { failures = [], success, processed, total, failure_count, skipped_count, elapsed_seconds, offline_skipped = 0, offline_roots = [] } = data;
const offlineRootNames = offline_roots.map((root) => root.label || root.path || String(root)).join(', ');
// Build failure list HTML
const failureRows = failures.map((f, i) =>
@@ -935,6 +937,13 @@ export class BaseModelApiClient {
<span class="stat-card-value">${skipped_count}</span>
</div>
</div>
${offline_skipped > 0 ? `
<div class="stat-card stat-card-offline" title="${this._escapeHtml(offlineRootNames)}">
<div class="stat-card-body">
<span class="stat-card-label">${translate('modals.metadataFetchSummary.statOffline', {}, 'Drive Offline')}</span>
<span class="stat-card-value">${offline_skipped}</span>
</div>
</div>` : ''}
<div class="stat-card stat-card-total">
<div class="stat-card-body">
<span class="stat-card-label">${translate('modals.metadataFetchSummary.statTotal', {}, 'Total Scanned')}</span>