修复模拟盘卖币握锁导致 database is locked 与中控超时离线。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1611,6 +1611,9 @@ def get_db():
|
||||
conn.row_factory = sqlite3.Row
|
||||
try:
|
||||
conn.execute("PRAGMA busy_timeout=30000")
|
||||
# WAL:读(中控快照)与写(卖币/同步)可并行,避免 database is locked→全部超时离线
|
||||
conn.execute("PRAGMA journal_mode=WAL")
|
||||
conn.execute("PRAGMA synchronous=NORMAL")
|
||||
except Exception:
|
||||
pass
|
||||
return conn
|
||||
@@ -5119,11 +5122,14 @@ def background_task():
|
||||
while True:
|
||||
try:
|
||||
auto_transfer_once_per_day()
|
||||
conn = get_db()
|
||||
# force_close 自带连接,勿套在另一未关闭连接上
|
||||
force_close_before_reset()
|
||||
reconcile_external_closes(conn)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
conn = get_db()
|
||||
try:
|
||||
reconcile_external_closes(conn)
|
||||
conn.commit()
|
||||
finally:
|
||||
conn.close()
|
||||
check_key_monitors()
|
||||
check_order_monitors()
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user