* Atomically check the lock and kick off a backfill. Returns synchronously * with `started: true` (caller should respond 202) or `started: false` * (caller should respond 409). The actual backfill runs as a fire-and-forget * task; errors are logged inside `backfillVideoMetadata` itself.
({ trigger = 'manual' } = {})
| 753 | * task; errors are logged inside `backfillVideoMetadata` itself. |
| 754 | */ |
| 755 | tryStartBackfill({ trigger = 'manual' } = {}) { |
| 756 | if (this._backfillRunning) { |
| 757 | return { started: false, reason: 'already-running' }; |
| 758 | } |
| 759 | // backfillVideoMetadata sets the flag synchronously before its first await, |
| 760 | // so launching it here is race-free for in-process callers. |
| 761 | this.backfillVideoMetadata({ trigger }).catch((err) => { |
| 762 | logger.error({ err }, 'Manual backfill run failed'); |
| 763 | }); |
| 764 | return { started: true }; |
| 765 | } |
| 766 | |
| 767 | isBackfillRunning() { |
| 768 | return this._backfillRunning; |
no test coverage detected