feat: fpw plugins, validation/crawl perf, WS stats, test DB isolation
- Add Free_Proxy_Website-style fpw_* plugins and register them - Per-plugin crawl timeout (crawl_timeout_seconds=120); remove global crawl_timeout setting - Validator: fix connect vs total timeout on save; SOCKS session LRU cache; drop redundant semaphore - Validation handler uses single DB connection; batch upsert after crawl; WorkerPool put_nowait - Remove unused max_retries from settings API/UI; settings maintenance SQL + init_db cleanup of deprecated keys - WebSocket dashboard stats; ProxyList pool_filter and API alignment - POST /api/proxies/delete-one for IPv6-safe deletes; task poll stops on 404 - pytest uses PROXYPOOL_DB_PATH=db/proxies.test.sqlite so tests do not wipe production DB - .gitignore: explicit proxies.test.sqlite patterns; fix plugin_service ValidationException import Made-with: Cursor
This commit is contained in:
35
scripts/apply_settings_maintenance.py
Normal file
35
scripts/apply_settings_maintenance.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""对 SQLite settings 表执行维护 SQL(见 db_optimize_settings.sql)。
|
||||
|
||||
使用当前应用配置的数据库路径(app.core.db.DB_PATH)。pytest 使用 PROXYPOOL_DB_PATH
|
||||
指向 db/proxies.test.sqlite,勿在生产库路径上误跑测试夹具。
|
||||
"""
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
# 保证可 import app
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
from app.core.db import DB_PATH, ensure_db_dir
|
||||
import aiosqlite
|
||||
|
||||
sql_path = os.path.join(os.path.dirname(__file__), "db_optimize_settings.sql")
|
||||
with open(sql_path, encoding="utf-8") as f:
|
||||
script = f.read()
|
||||
|
||||
ensure_db_dir()
|
||||
if not os.path.isfile(DB_PATH):
|
||||
print(f"数据库不存在,跳过: {DB_PATH}")
|
||||
return
|
||||
|
||||
async with aiosqlite.connect(DB_PATH) as db:
|
||||
await db.executescript(script)
|
||||
await db.commit()
|
||||
print(f"已执行设置维护: {DB_PATH}")
|
||||
print("请重启应用或在 WebUI 保存一次设置以使并发/超时生效。")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user