Handle resumable gmcli backfill coverage
This commit is contained in:
@@ -35,20 +35,28 @@
|
|||||||
pass=1
|
pass=1
|
||||||
while ((pass <= 20)); do
|
while ((pass <= 20)); do
|
||||||
echo "Starting gmcli deep-history pass $pass/20"
|
echo "Starting gmcli deep-history pass $pass/20"
|
||||||
if result="$(${gmcliPackage}/bin/gmcli --json history backfill-all --requests 20 --count 100)"; then
|
result="$(${gmcliPackage}/bin/gmcli --json history backfill-all --requests 20 --count 100)"
|
||||||
added="$(${pkgs.jq}/bin/jq -er '.messages_added' <<<"$result")" || {
|
backfill_status=$?
|
||||||
echo "Unable to read messages_added from backfill result" >&2
|
metrics="$(${pkgs.jq}/bin/jq -er '[.messages_added, .failed, .needs_more] | @tsv' <<<"$result")" || {
|
||||||
status=1
|
echo "Unable to read coverage metrics from backfill result" >&2
|
||||||
break
|
|
||||||
}
|
|
||||||
echo "Deep-history pass $pass added $added message(s)"
|
|
||||||
if ((added == 0)); then
|
|
||||||
exhausted=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
status=1
|
status=1
|
||||||
break
|
break
|
||||||
|
}
|
||||||
|
IFS=$'\t' read -r added failed needs_more <<<"$metrics"
|
||||||
|
echo "Deep-history pass $pass added $added message(s); $needs_more conversation(s) need more"
|
||||||
|
if ((failed > 0)); then
|
||||||
|
echo "Deep-history pass failed for $failed conversation(s)" >&2
|
||||||
|
status=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if ((backfill_status != 0 && needs_more == 0)); then
|
||||||
|
echo "Deep-history command failed without resumable work" >&2
|
||||||
|
status=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if ((needs_more == 0)); then
|
||||||
|
exhausted=1
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
((pass++))
|
((pass++))
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user