#!/usr/bin/env bash
set -euo pipefail

# Use `xargs` to parallelize jobs, since most of our runtime seems to be spent
# sleeping.
# Use `... || true` to ignore failures and continue running.
vehicle/common/config/backfill_vehicle_config/find_runs_missing_derived_topics "$@" |
  xargs --max-args=1 --max-procs=8 --no-run-if-empty --replace={} \
    bash -c "vehicle/common/config/backfill_vehicle_config/backfill_vehicle_config --ingest_meta_id={} || true"
