Skip to content

Commit

Permalink
fixed scripts/export-bids-auto.sh (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris authored Mar 21, 2023
1 parent 47d4c1d commit 6640511
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions scripts/export-bids-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@ echo "latest_slot_exported: $latestslot_exported"
latestslot=$( curl -s https://beaconcha.in/latestState | jq '.lastProposedSlot' )
echo "latest slot: $latestslot"

# Compute latest slot to export
last_slot_to_export=$((latestslot_exported + BUCKET_SIZE))
echo "last_slot_to_export: $last_slot_to_export"

# End now if latest slot to export is in the future
if (( last_slot_to_export > latestslot )); then
echo "latest slot to export is in the future. exiting now"
exit 0
fi

# Export now
# Start at last exported slot +1
slot_start=$((latestslot_exported + 1))
slot_end=$last_slot_to_export
cmd="$SCRIPT_DIR/export-bids.sh $slot_start $slot_end"
echo $cmd
$cmd

# Now loop over buckets until all slots are exported
while true; do
slot_end=$((slot_start + BUCKET_SIZE - 1))
echo "slots to export: $slot_start - $slot_end"

# End now if latest slot to export is in the future
if (( slot_end > latestslot )); then
echo "latest slot to export is in the future. exiting now"
exit 0
fi

# Export now
cmd="$SCRIPT_DIR/export-bids.sh $slot_start $slot_end"
echo $cmd
$cmd
slot_start=$((slot_start + BUCKET_SIZE))
done

0 comments on commit 6640511

Please sign in to comment.