db: INSERT IGNORE on schema_migrations to tolerate multi-worker boot race
This commit is contained in:
parent
d333af014e
commit
d3369bb141
1 changed files with 3 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue