fix: 全部写库scanner统一加busy_timeout=30000——整点撞锁SQLite自动等待,根治崩溃
This commit is contained in:
@@ -52,6 +52,7 @@ def load_mkt_rsi():
|
||||
"""从 stock_daily 计算大盘 RSI14(与回测零偏差——回测用的就是 stock_daily)"""
|
||||
try:
|
||||
conn = sqlite3.connect(str(DB_PATH), timeout=5)
|
||||
conn.execute("PRAGMA busy_timeout=30000") # 2026-08-18 整点撞锁等待
|
||||
rows = conn.execute(
|
||||
"SELECT date, close FROM stock_daily WHERE code='sh000001'"
|
||||
" ORDER BY date DESC LIMIT 40").fetchall()
|
||||
@@ -163,6 +164,7 @@ def main():
|
||||
|
||||
# ── 幂等:当天已有 s2_panic 候选则跳过 ──
|
||||
conn = sqlite3.connect(str(DB_PATH), timeout=5)
|
||||
conn.execute("PRAGMA busy_timeout=30000") # 2026-08-18 整点撞锁等待
|
||||
try:
|
||||
_today = datetime.now().strftime("%Y-%m-%d")
|
||||
_n = conn.execute(
|
||||
@@ -207,6 +209,7 @@ def main():
|
||||
|
||||
# ── 写 candidates(sector='s2_panic',UPSERT)──
|
||||
conn = sqlite3.connect(str(DB_PATH), timeout=5)
|
||||
conn.execute("PRAGMA busy_timeout=30000") # 2026-08-18 整点撞锁等待
|
||||
inserted = 0
|
||||
for code, sig in found[:top_n]:
|
||||
name = code
|
||||
|
||||
Reference in New Issue
Block a user