Skip to content

fix: prevent restore timeout for large imports - #673

Merged
hmjn023 merged 1 commit into
developfrom
fix/ndjson-restore-timeout
Aug 13, 2026
Merged

fix: prevent restore timeout for large imports#673
hmjn023 merged 1 commit into
developfrom
fix/ndjson-restore-timeout

Conversation

@hmjn023

@hmjn023 hmjn023 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

概要

大容量のNDJSON/TAR restoreが同期APIの30秒タイムアウトで失敗する問題を修正します。

変更内容

  • NDJSON/TAR restoreをenqueueImportによるバックグラウンドジョブへ変更
  • restore完了待ちではなく、ジョブ投入済みのtoastを表示
  • Web/TauriクライアントとAPIクライアントテストを更新

検証

  • 対象Vitest: 5 tests passed
  • Biome check: passed
  • 全体typecheckは既存のNode型・生成route・dghs-imgutils-rs未解決エラーで失敗

Summary by CodeRabbit

  • 新機能
    • TAR(ZIP)およびNDJSONファイルのインポートを、非同期ジョブとして登録できるようになりました。
    • インポート登録後、ジョブIDの先頭8文字を通知するようになりました。
  • 改善
    • 大容量ファイルのインポート処理中も、画面を待機させずに操作を継続できます。
    • インポート完了後に、メディア一覧を更新して結果を確認できます。

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 66c1c4b0-f62b-4091-91b8-0bf2bccfb9ac

📥 Commits

Reviewing files that changed from the base of the PR and between d851521 and b475bb9.

📒 Files selected for processing (4)
  • apps/server/src/infrastructure/api-clients/sources-api.ts
  • apps/server/src/tests/unit/infrastructure/api-clients/sources-api-ext.test.ts
  • apps/tauri/src/infrastructure/api-clients/sources-api.ts
  • packages/ui/src/hooks/use-source-media-page.ts

📝 Walkthrough

Walkthrough

ZIPおよびNDJSONのインポートを、同期処理から非同期ジョブ登録へ変更しました。UIはインポート結果ではなくJobDtoを受け取り、ジョブIDを通知します。

Changes

ソースインポートのジョブ登録

Layer / File(s) Summary
インポートAPIのジョブ登録
apps/server/src/infrastructure/api-clients/sources-api.ts, apps/tauri/src/infrastructure/api-clients/sources-api.ts, apps/server/src/tests/unit/infrastructure/api-clients/sources-api-ext.test.ts
ZIPはmode: "zip"、NDJSONはmode: "json"を指定してenqueueImportを呼び出します。テストは対象ID、ファイル、モード、返却値を検証します。
復元処理のジョブ対応
packages/ui/src/hooks/use-source-media-page.ts
importSourceZipimportSourceNdjsonの戻り値をPromise<JobDto>に変更します。復元処理はジョブID先頭8文字を通知します。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to b475b

Large NDJSON/TAR restores now run through background jobs instead of waiting on the synchronous timeout, while clients report that the job was submitted. No actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant SourceMediaPage
  participant sources-api
  participant enqueueImport
  SourceMediaPage->>sources-api: ZIPまたはNDJSONファイルを渡す
  sources-api->>enqueueImport: id、ファイル、モードを渡す
  enqueueImport-->>sources-api: JobDtoを返す
  sources-api-->>SourceMediaPage: JobDtoを返す
  SourceMediaPage-->>SourceMediaPage: ジョブID先頭8文字を通知
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、大規模インポートで発生する復元タイムアウトを防止する主な変更内容を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ndjson-restore-timeout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hmjn023
hmjn023 merged commit 09b1357 into develop Aug 13, 2026
1 check passed
@hmjn023
hmjn023 deleted the fix/ndjson-restore-timeout branch August 14, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant