infrastructure

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit c75ce2073ef9244e3287b02d12fe6cfe88458fab
parent 521d4fa653e1a46518fb7470dd56c44d050e0c94
Author: Silas Brack <silasbrack@gmail.com>
Date:   Sat,  4 Jul 2026 22:14:39 +0200

fix: skip missing log files in query-logs

HEAD-check each URL before passing to DuckDB to avoid 404 errors
on hours with no archived logs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Diffstat:
Mflake.nix | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/flake.nix b/flake.nix @@ -83,15 +83,22 @@ UNTIL="''${2:-$(date +%Y-%m-%dT%H)}" SQL="''${3:-SELECT * FROM logs ORDER BY timestamp DESC LIMIT 50}" - # Generate hourly URLs between SINCE and UNTIL + # Generate hourly URLs between SINCE and UNTIL, skipping missing files urls="" current=$(date -d "''${SINCE}:00:00" +%s) end=$(date -d "''${UNTIL}:00:00" +%s) while [ "$current" -le "$end" ]; do path=$(date -d "@$current" +%Y/%m/%d/%H) - urls="$urls '$BASE_URL/$path.json.gz'," + url="$BASE_URL/$path.json.gz" + if ${pkgs.curl}/bin/curl -sf --head "$url" > /dev/null 2>&1; then + urls="$urls '$url'," + fi current=$((current + 3600)) done + if [ -z "$urls" ]; then + echo "No log files found for the given range." + exit 0 + fi urls="[''${urls%,}]" ${pkgs.duckdb}/bin/duckdb -c "