fix: 全部写库scanner统一加busy_timeout=30000——整点撞锁SQLite自动等待,根治崩溃

This commit is contained in:
xxm
2026-08-18 10:00:19 +08:00
parent e18cf7e76e
commit 0070141bce
6 changed files with 23 additions and 0 deletions
+3
View File
@@ -37,6 +37,7 @@ def get_hk_regime():
pass
try:
conn = sqlite3.connect(str(DB_PATH), timeout=5)
conn.execute("PRAGMA busy_timeout=30000") # 2026-08-18 整点撞锁等待
row = conn.execute(
"SELECT regime FROM market_regime WHERE market='hk' ORDER BY date DESC LIMIT 1").fetchone()
conn.close()
@@ -49,6 +50,7 @@ def trend_down_streak():
"""trend_down 连续天数(防守用)"""
try:
conn = sqlite3.connect(str(DB_PATH), timeout=5)
conn.execute("PRAGMA busy_timeout=30000") # 2026-08-18 整点撞锁等待
rows = conn.execute(
"SELECT date, regime FROM market_regime WHERE market='hk' ORDER BY date DESC LIMIT 30").fetchall()
conn.close()
@@ -107,6 +109,7 @@ def main():
print(f" 激活策略: {versions}", flush=True)
conn = sqlite3.connect(str(DB_PATH), timeout=5)
conn.execute("PRAGMA busy_timeout=30000") # 2026-08-18 整点撞锁等待
inserted = 0
for v in versions:
strat = HK_STRATEGIES[v]