Skip to content

Commit

Permalink
ci fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Oct 18, 2024
1 parent 84e06dd commit d211515
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ jobs:
sudo mv target/release/fossil_headers_db /usr/local/bin/fossil_headers_db
sudo systemctl daemon-reload
sudo systemctl restart fossil_headers_db
# Ensure no conflicting service is running
sudo systemctl stop fossil_headers_db || true
# Restart the service and verify status
sudo systemctl start fossil_headers_db
sudo systemctl status fossil_headers_db --no-pager
# Ensure psql is installed
sudo apt update && sudo apt install -y postgresql-client
# Fetch the first missing block - 1 using PSQL
START_BLOCK=$(psql -U postgres -d fossil -t -c "
WITH block_range AS (
Expand All @@ -51,7 +59,13 @@ jobs:
FROM all_blocks
LEFT JOIN public.blockheaders bh ON all_blocks.block_number = bh.number
WHERE bh.number IS NULL
) SELECT MIN(block_number) - 1 FROM missing_blocks;")
) SELECT COALESCE(MIN(block_number) - 1, 0) FROM missing_blocks;")
if [ -z "$START_BLOCK" ]; then
echo "Failed to determine start block"; exit 1;
fi
echo "Starting block: $START_BLOCK"
# Run cargo with the calculated start block
nohup cargo run fix --start $START_BLOCK &

0 comments on commit d211515

Please sign in to comment.