---
title: "Flush Wal"
method: POST
path: "/api/admin/flush-wal"
tags: ["admin"]
---

# Flush Wal

`POST /api/admin/flush-wal`

## Request

- Base URL: `https://www.awardflightdaily.com` (the document declares no server; this is the origin it was published from)
- URL: `https://www.awardflightdaily.com/api/admin/flush-wal`
- Auth: none declared

Spawn a checkpoint subprocess to merge the WAL into the main DB file.

Why a subprocess instead of `con.execute("FORCE CHECKPOINT")` in-process:
on the production 13 GB DuckDB file the in-process call hung for 20+
minutes at the first attempt during ingestion (verified 2026-04-30) —
FastAPI's `_db_conn` keeps fielding admin polls, FORCE CHECKPOINT waits
to abort those transactions, and the wait never resolves. The
subprocess pattern (used by the periodic CHECKPOINT cron, the
post-ingestion CHECKPOINT, and the mid-ingestion CHECKPOINT) bypasses
this by running in a separate process: it acquires the DuckDB file-
level writer lock cleanly and core.get_db() returns clean 503s
(via /data/archive.lock presence) for the duration.

Returns immediately. The subprocess removes /data/archive.lock when
finished. Watch Railway logs for "Manual CHECKPOINT subprocess
spawned" and a few minutes later "Removed archive lock file".

## Response `200`

Successful Response

- unknown

---

[API](https://skmtc.dev/awardflightdaily/apis/award-flight-database.md) · [All operations](https://skmtc.dev/awardflightdaily/apis/award-flight-database/llms.txt) · [OpenAPI document](https://skmtc.dev/awardflightdaily/apis/award-flight-database/revisions/93e62de446f9?raw)
