bumped padding of bundles to 6 digits

This commit is contained in:
Joe Lothan 2026-05-25 23:56:13 -04:00
parent 59d4d2c9e0
commit 53205ab661
4 changed files with 5 additions and 5 deletions

View file

@ -60,7 +60,7 @@ function pickBundle() {
// Fetch a bundle JSON
async function fetchBundle(idx) {
const padded = String(idx).padStart(4, "0");
const padded = String(idx).padStart(6, "0");
const resp = await fetch(`tabs/${padded}.json`);
if (!resp.ok) throw new Error(`Failed to fetch bundle ${padded}`);
const data = await resp.json();

View file

@ -74,11 +74,11 @@ func serializeBundle(entries []BundleEntry) ([]byte, error) {
}
func writeBundleLocal(outputDir string, index int, data []byte) error {
path := filepath.Join(outputDir, fmt.Sprintf("%04d.json", index))
path := filepath.Join(outputDir, fmt.Sprintf("%06d.json", index))
return os.WriteFile(path, data, 0644)
}
func writeBundleS3(bucket string, index int, data []byte) error {
key := fmt.Sprintf("tabs/%04d.json", index)
key := fmt.Sprintf("tabs/%06d.json", index)
return s3UploadBundle(bucket, key, data)
}

View file

@ -237,7 +237,7 @@ func main() {
fmt.Printf(" %d/%d bundles\n", n, estimatedTotal)
}
logLine := fmt.Sprintf("bundle: %04d.json %dKB", job.index, len(job.data)/1024)
logLine := fmt.Sprintf("bundle: %06d.json %dKB", job.index, len(job.data)/1024)
if logWriter != nil {
logWriter.Write(logLine, false)
}

View file

@ -98,7 +98,7 @@ if [ "$OLD_TOTAL" -gt "$TOTAL_BUNDLES" ]; then
STALE_COUNT=$((OLD_TOTAL - TOTAL_BUNDLES))
echo "Deleting $STALE_COUNT stale bundles ($TOTAL_BUNDLES to $((OLD_TOTAL - 1)))..."
for i in $(seq "$TOTAL_BUNDLES" "$((OLD_TOTAL - 1))"); do
PADDED=$(printf "%04d" "$i")
PADDED=$(printf "%06d" "$i")
aws s3 rm "s3://$SITE_BUCKET/tabs/${PADDED}.json" --quiet
done
echo "Deleted $STALE_COUNT stale bundles"