From d3369bb141397b1d286faf0458b24a873a377dc3 Mon Sep 17 00:00:00 2001 From: Kayos Date: Tue, 28 Apr 2026 19:49:40 -0700 Subject: [PATCH] db: INSERT IGNORE on schema_migrations to tolerate multi-worker boot race --- cauldron/db.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cauldron/db.py b/cauldron/db.py index c860082..3561283 100644 --- a/cauldron/db.py +++ b/cauldron/db.py @@ -100,8 +100,10 @@ class DB: if ver in done: continue cur.execute(sql) + # IGNORE to tolerate the multi-worker boot race where two + # gunicorn workers both bootstrap an empty migrations table cur.execute( - "INSERT INTO schema_migrations (version) VALUES (%s)", (ver,) + "INSERT IGNORE INTO schema_migrations (version) VALUES (%s)", (ver,) ) applied.append(ver) return applied