{"id":480266,"date":"2026-05-19T11:51:28","date_gmt":"2026-05-19T11:51:28","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=480266"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=480266","title":{"rendered":"\u041a\u0430\u043a \u043c\u044b \u0432\u044b\u0432\u0435\u043b\u0438 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 yt-dlp, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0436\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043b\u043e\u0433\u0430\u0445. Bridge \u043d\u0430 200 \u0441\u0442\u0440\u043e\u043a \u0438 \u0431\u043e\u0440\u044c\u0431\u0430 \u0441 alert-fatigue"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440. \u042f \u0434\u0435\u043b\u0430\u044e \u043e\u043d\u043b\u0430\u0439\u043d-\u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e, \u0431\u044d\u043a\u0435\u043d\u0434 \u043d\u0430 Python (FastAPI + yt-dlp). \u0417\u0430 \u043c\u0435\u0441\u044f\u0446 \u043d\u0430\u0431\u0440\u0430\u043b\u0438 ~1500 DAU \u0438 \u0443\u043f\u0451\u0440\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0436\u0430\u043b\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u00ab\u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00bb, \u0430 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0437\u0435\u043b\u0451\u043d\u044b\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043b\u0447\u0430 \u0443\u043c\u0438\u0440\u0430\u043b\u0438 \u0432 \u043b\u043e\u0433\u0430\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u0430, \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u0439 \u0436\u0435 \u0440\u0435\u043b\u0438\u0437 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c \u0438\u0437-\u0437\u0430 alert-fatigue.<\/p>\n<\/blockquote>\n<h3>TL;DR<\/h3>\n<ol>\n<li>\n<p>\u0423 \u043d\u0430\u0441 3 \u043d\u043e\u0434\u044b: master (FastAPI \u043d\u0430 :443) \u0438 2 worker\u2019\u0430 (Docker, yt-dlp). \u0412\u043e\u0440\u043a\u0435\u0440\u044b \u043f\u0430\u0434\u0430\u043b\u0438 \u0432 <code>unavailable<\/code> \/ <code>private<\/code> \/ <code>age-restricted<\/code>, \u043d\u043e \u044d\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u0434\u043e \u0430\u0434\u043c\u0438\u043d\u043a\u0438 \u2014 \u043e\u043d\u0438 \u0443\u043c\u0438\u0440\u0430\u043b\u0438 \u0432 <code>docker logs<\/code>, \u0433\u0434\u0435 \u0438\u0445 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u043b.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0434\u0435\u043b\u0430\u043b\u0438 bridge: \u0432\u043e\u0440\u043a\u0435\u0440 POST\u2019\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 master \u043f\u043e <code>\/admin\/api\/incidents\/external<\/code> \u0441 <code>X-Internal-Secret<\/code>, master \u043f\u0438\u0448\u0435\u0442 \u0432 SQLite (<code>AdminEvent<\/code>) \u0438 \u0448\u043b\u0451\u0442 push \u0430\u0434\u043c\u0438\u043d\u0430\u043c, \u0435\u0441\u043b\u0438 \u22655 \u043e\u0448\u0438\u0431\u043e\u043a \u0437\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0436\u0435 \u0441\u043b\u043e\u0432\u0438\u043b\u0438 alert-fatigue: 90% \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u2014 \u044d\u0442\u043e \u00ab\u044e\u0437\u0435\u0440 \u0441\u043a\u0438\u043d\u0443\u043b \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435\/\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043e\u00bb, \u0442\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0448\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0414\u043e\u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 content-vs-infra: \u00ab\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u0435\u00bb \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0436\u0443\u0440\u043d\u0430\u043b \u043f\u0438\u0448\u0435\u043c, \u043d\u043e push \u043d\u0435 \u0434\u0451\u0440\u0433\u0430\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430 \u0430\u0434\u043c\u0438\u043d\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443: 7 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 200. \u0418\u0437 \u043d\u0438\u0445 2 \u2014 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0448 \u0431\u0430\u0433 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 ID \u0432\u0438\u0434\u0435\u043e \u0440\u043e\u043d\u044f\u043b preflight \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u0445). \u041f\u043e\u0447\u0438\u043d\u0438\u043b\u0438 \u0437\u0430 \u0447\u0430\u0441.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0438\u0436\u0435 \u2014 \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u0438 \u0447\u0442\u043e \u044f \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u043d\u0430\u0447\u0435.<\/p>\n<hr\/>\n<h3>\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442: \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 \u0443\u043c\u0438\u0440\u0430\u043b\u0438<\/h3>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0430\u044f:<\/p>\n<pre><code>[ \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u044e\u0437\u0435\u0440\u0430 ]       \u2502       \u25bc[ master  FastAPI :443 ]\u2500\u2500\u252c\u2500\u2500&gt; \/api\/info  (preflight, yt-dlp --skip-download)       \u2502                   \u2514\u2500\u2500&gt; \/api\/prepare \u2192 \u0432\u044b\u0431\u043e\u0440 \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u2192 POST \u043a worker'\u0443       \u2502       \u25bc[ worker1 ] [ worker2 ]   (docker compose, yt-dlp \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0432 \/tmp)       \u2502       \u25bc   \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2192 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0441 master \u043f\u043e \/file\/{task_id}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>\/api\/info<\/code> \u0431\u044c\u0451\u0442\u0441\u044f \u0432 YouTube-API \u0447\u0435\u0440\u0435\u0437 yt-dlp \u043f\u0440\u044f\u043c\u043e \u0441 master\u2019\u0430. \u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0435\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \/ \u0443\u0434\u0430\u043b\u0435\u043d\u043e \/ age-gated \u2014 <code>yt-dlp<\/code> \u0431\u0440\u043e\u0441\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, master \u043b\u043e\u0432\u0438\u0442 \u0435\u0433\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c <code>try\/except<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 400 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<p>\u0411\u0435\u0434\u0430 \u0432\u043e\u0442 \u0432 \u0447\u0451\u043c: \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <strong>\u0443\u0445\u043e\u0434\u0438\u043b\u043e \u0432 access.log \u0441 status=400 \u0438 \u0432\u0441\u0451<\/strong>. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a. \u041d\u0438\u043a\u0430\u043a\u043e\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438. \u042f \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u00ab4xx \u043e\u043a\u043e\u043b\u043e 5%\u00bb, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u043b, <em>\u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e 5%<\/em>.<\/p>\n<p>\u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0441\u0442\u043e\u044f\u043b\u0430 \u0446\u0435\u043b\u044c <code>download_error<\/code>, \u043d\u043e \u043e\u043d\u0430 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0438\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 <code>\/api\/prepare<\/code> \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u044e\u0437\u0435\u0440 \u0443\u0436\u0435 \u043d\u0430\u0436\u0430\u043b \u00ab\u0441\u043a\u0430\u0447\u0430\u0442\u044c\u00bb. \u0410 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0436\u0438\u043b\u0430 \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u0438 preflight (<code>\/api\/info<\/code>), \u043a\u0443\u0434\u0430 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430 \u0432\u043e\u043e\u0431\u0449\u0435.<\/p>\n<h3>\u0428\u0430\u0433 1: bridge worker \u2192 master<\/h3>\n<p>\u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c fire-and-forget POST \u0438\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"python\"># master_main.py \u2014 \u0432\u043d\u0443\u0442\u0440\u0438 \/api\/info exception handlerexcept Exception as e:    msg = str(e)    asyncio.create_task(_report_info_error(req.url, msg))    if \"unavailable\" in msg.lower() or \"copyright\" in msg.lower():        raise HTTPException(status_code=400, detail=\"\u0412\u0438\u0434\u0435\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043e\")    raise HTTPException(status_code=500, detail=msg)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>_report_info_error<\/code> \u0448\u043b\u0451\u0442 POST \u043d\u0430 <code>\/admin\/api\/incidents\/external<\/code> \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 (auth-service, \u0442\u043e\u0436\u0435 FastAPI \u043d\u0430 :8770, \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0430\u0431\u0438\u043d\u0435\u0442 \u0438 \u0430\u0434\u043c\u0438\u043d\u043a\u0443). \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a <code>X-Internal-Secret<\/code> \u2014 \u043e\u0431\u0449\u0438\u0439 env-secret, \u0447\u0442\u043e\u0431\u044b \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043d\u0435 \u043c\u043e\u0433 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0430\u0434\u043c\u0438\u043d\u0441\u043a\u0438\u0439 \u0436\u0443\u0440\u043d\u0430\u043b.<\/p>\n<pre><code class=\"python\">async def _report_info_error(url: str, error: str):    try:        async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=2)) as s:            await s.post(                \"http:\/\/127.0.0.1:8770\/admin\/api\/incidents\/external\",                json={\"source\": \"info\", \"video_id\": _extract_video_id(url),                      \"error\": error[:500], \"worker\": \"master\"},                headers={\"X-Internal-Secret\": INTERNAL_SECRET},            )    except Exception:        # bridge \u0443\u043f\u0430\u043b \u2014 \u044d\u0442\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f        pass<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p><code><strong>asyncio.create_task<\/strong><\/code>, \u0430 \u043d\u0435 <code>await<\/code>. \u042e\u0437\u0435\u0440 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0436\u0434\u0430\u0442\u044c, \u043f\u043e\u043a\u0430 bridge \u0434\u043e\u0441\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u0434\u043e \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0415\u0441\u043b\u0438 bridge \u0441\u043b\u043e\u043c\u0430\u043d, \u0444\u0440\u043e\u043d\u0442\u0443 \u044d\u0442\u043e \u0431\u0435\u0437\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>timeout=2 \u0441\u0435\u043a<\/strong>. \u0418\u043d\u0430\u0447\u0435 \u043f\u043e\u0434\u0432\u0438\u0441\u0448\u0438\u0439 bridge \u0443\u0442\u044f\u043d\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u0432\u0435\u0442 \u044e\u0437\u0435\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p><code><strong>error[:500]<\/strong><\/code> \u2014 \u043e\u0431\u0440\u0435\u0437\u0430\u0435\u043c traceback. \u042f \u043e\u0431\u0436\u0451\u0433\u0441\u044f \u2014 yt-dlp \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u044b\u0434\u0430\u0451\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e 8 \u041a\u0411 \u0441 \u0434\u0430\u043c\u043f\u043e\u043c \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0430.<\/p>\n<\/li>\n<li>\n<p><code><strong>except: pass<\/strong><\/code> \u0432 bridge \u2014 \u0434\u0430, \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d. \u041d\u043e \u044d\u0442\u043e \u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u044f, \u0430 \u043d\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430. \u0415\u0441\u043b\u0438 bridge \u0440\u043e\u043d\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <code>\/api\/info<\/code>, \u0443 \u0442\u0435\u0431\u044f \u0434\u044b\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 master\u2019\u0430 \u0435\u0449\u0451 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 bridge \u0432 worker callback (\u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0440\u043a\u0435\u0440 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 master\u2019\u0443 \u2014 \u043c\u044b \u0442\u043e\u0436\u0435 \u043b\u043e\u0432\u0438\u043c status \u0438 \u0448\u043b\u0451\u043c \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0443, \u0435\u0441\u043b\u0438 4xx\/5xx).<\/p>\n<h3>\u0428\u0430\u0433 2: storage \u0432 master<\/h3>\n<p>\u0412 auth-service (\u0442\u043e\u0442, \u0447\u0442\u043e \u0430\u0434\u043c\u0438\u043d\u043a\u0430) \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430 <code>AdminEvent<\/code>:<\/p>\n<pre><code class=\"python\">class AdminEvent(Base):    __tablename__ = \"admin_events\"    id = Column(Integer, primary_key=True)    created_at = Column(DateTime, server_default=func.now())    kind = Column(String(64))         # 'download_error', 'login', \u0438 \u0442.\u0434.    payload_json = Column(Text)       # \u0441\u044b\u0440\u043e\u0439 JSON<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Endpoint \u043f\u0440\u043e\u0441\u0442\u043e\u0439:<\/p>\n<pre><code class=\"python\">@router.post(\"\/admin\/api\/incidents\/external\")async def incidents_external(payload: IncidentPayload, request: Request):    if request.headers.get(\"X-Internal-Secret\") != INTERNAL_SECRET:        raise HTTPException(403, \"Forbidden\")    async with SessionLocal() as session:        ev = AdminEvent(            kind=\"download_error\",            payload_json=json.dumps({                \"source\": payload.source,           # 'info' \/ 'task_status' \/ ...                \"video_id\": payload.video_id,                \"error\": payload.error,                \"worker\": payload.worker,                \"url\": payload.url,            }, ensure_ascii=False),        )        session.add(ev)        await session.commit()    # \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u0431\u0430\u0433 \u2014 \u0441\u043c. \u043d\u0438\u0436\u0435    incidents_svc.report_error(payload.status_code or 500, f\"download:{payload.video_id}\")    return {\"ok\": True}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>incidents_svc.report_error<\/code> \u2014 \u044d\u0442\u043e in-memory \u0441\u0447\u0451\u0442\u0447\u0438\u043a: \u0435\u0441\u043b\u0438 \u0437\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u22655 \u043e\u0448\u0438\u0431\u043e\u043a, \u0434\u0451\u0440\u0433\u0430\u0435\u0442\u0441\u044f push-broadcast \u0430\u0434\u043c\u0438\u043d\u0430\u043c \u0447\u0435\u0440\u0435\u0437 Web Push API.<\/p>\n<p>\u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u041e\u0434\u0438\u043d \u0434\u0435\u043d\u044c. \u0414\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0435\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u043f\u0438\u043a\u0430.<\/p>\n<h3>\u0428\u0430\u0433 3: alert-fatigue<\/h3>\n<p>\u0412 21:43 \u043c\u043d\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u043f\u043e\u0434\u0440\u044f\u0434 4 push\u2019\u0430: \u00abBurst: 12 download_errors\u00bb. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u0430\u0434\u043c\u0438\u043d\u043a\u0443 \u2014 \u0442\u0430\u043c 47 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0437\u0430 \u043c\u0438\u043d\u0443\u0442\u0443.<\/p>\n<p>\u0418\u0437 \u043d\u0438\u0445:<\/p>\n<ul>\n<li>\n<p>31 \u2014 <code>Sign in to confirm you're not a bot<\/code><\/p>\n<\/li>\n<li>\n<p>8 \u2014 <code>Private video. Sign in if you've been granted access<\/code><\/p>\n<\/li>\n<li>\n<p>5 \u2014 <code>This video is age-restricted and only available on YouTube<\/code><\/p>\n<\/li>\n<li>\n<p>2 \u2014 <code>Video unavailable. The uploader has not made this video available in your country<\/code><\/p>\n<\/li>\n<li>\n<p>1 \u2014 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0448\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 (\u0442a\u0439\u043c\u0430\u0443\u0442 \u043d\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u0435)<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c <strong>46 \u0438\u0437 47<\/strong> \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0431\u0430\u0433\u0438, \u044d\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0435\/\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435\/age-gated\/\u0433\u0435\u043e-\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u043e\u043b\u0438\u043a\u0438. \u042d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u042d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0443\u0448\u0438\u0442\u044c.<\/p>\n<p>\u0415\u0449\u0451 \u0445\u0443\u0436\u0435: \u043f\u0443\u0448\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435, \u043d\u043e \u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043a \u043d\u0438\u043c \u043f\u0440\u0438\u0432\u044b\u043a. \u0427\u0435\u0440\u0435\u0437 \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u044f \u0431\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442.<\/p>\n<h3>\u0428\u0430\u0433 4: \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 content vs infra<\/h3>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043b\u043e\u0431 \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432:<\/p>\n<pre><code class=\"python\">err_lower = (payload.error or \"\").lower()is_content_error = any(p in err_lower for p in (    \"sign in to confirm\",         # bot-check, IP problem (\u043d\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043c\u043e\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442\u0435)    \"\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435\", \"private video\",    \"age-restricted\", \"members-only\",    \"video unavailable\", \"\u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\", \"\u0443\u0434\u0430\u043b\u0435\u043d\u043e\",    \"copyright\",    \"this video is not available in your country\",))if not is_content_error:    incidents_svc.report_error(payload.status_code or 500, f\"download:{payload.video_id}\")return {\"ok\": True, \"content_error\": is_content_error}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 <strong>\u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 <\/strong><code><strong>admin_events<\/strong><\/code> \u2014 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u044b\u0435 (\u0432\u0434\u0440\u0443\u0433 80% \u2014 <code>age-restricted<\/code> \u0438 \u044f \u0441\u043c\u043e\u0433\u0443 \u043e\u0431\u043e\u0439\u0442\u0438 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 fallback). \u041d\u043e push-burst \u043d\u0435 \u0434\u0451\u0440\u0433\u0430\u044e\u0442.<\/p>\n<p>\u0412 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u00ab\u041e\u0448\u0438\u0431\u043a\u0438\u00bb \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0444\u0438\u043b\u044c\u0442\u0440: \u00ab\u0412\u0441\u0435 \/ \u0422\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u0440\u0430 \/ \u0422\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u0435\u00bb. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u0440\u0430.<\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 Sign in to confirm \u044f \u043e\u0442\u043d\u0451\u0441 \u043a \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u043c<\/h4>\n<p>\u042d\u0442\u043e \u0441\u043f\u043e\u0440\u043d\u043e. <code>Sign in to confirm you're not a bot<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e YouTube \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043d\u0430\u0448 IP \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0431\u043e\u0442\u0430. \u042d\u0442\u043e <strong>\u043d\u0430\u0448\u0430<\/strong> \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435, \u0447\u0442\u043e \u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0431\u044b \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0437\u0430\u043f\u0430\u0441\u043d\u043e\u0439 IP (\u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043a\u0441\u0438-\u043f\u0443\u043b).<\/p>\n<p>\u041d\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442\u0435, \u043a\u043e\u0433\u0434\u0430 \u044e\u0437\u0435\u0440 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0448\u0438\u0431\u043a\u0443, \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0430 push\u2019\u043e\u043c \u2014 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e, \u044f \u043d\u0435 \u043f\u043e\u0447\u0438\u043d\u044e \u044d\u0442\u043e \u0440\u0443\u043a\u0430\u043c\u0438 \u0437\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043d\u043e\u0448\u0443 \u043a \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u043c \u0438 \u0440\u0435\u0448\u0430\u044e \u0447\u0435\u0440\u0435\u0437 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c: \u043c\u0435\u0442\u0440\u0438\u043a\u0430 <code>bot_check_rate<\/code> \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 &gt;5% \u0437\u0430 \u0447\u0430\u0441 \u2014 \u0442\u043e\u0433\u0434\u0430 \u0443\u0436\u0435 \u0430\u043b\u0435\u0440\u0442. Burst-detection \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0442\u0443\u0442 \u043d\u0435\u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u0435\u043d.<\/p>\n<h3>\u0428\u0430\u0433 5: \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0435\u0439<\/h3>\n<p>\u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0434\u0435\u043f\u043b\u043e\u0435 \u0441\u043b\u043e\u0432\u0438\u043b \u0434\u0432\u0435 \u0433\u043b\u0443\u043f\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<p><strong>1. <\/strong><code><strong>AdminEvent has no attribute 'payload'<\/strong><\/code><\/p>\n<p>\u042f \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b <code>ev.payload = ...<\/code>, \u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043b\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>payload_json<\/code>. \u0421\u0442\u0430\u0440\u044b\u0439 \u044f \u0431\u044b \u043e\u0442\u043b\u043e\u0432\u0438\u043b \u044d\u0442\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c, \u043d\u043e FastAPI \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 dev-\u0440\u0435\u0436\u0438\u043c\u0435 \u043d\u0435 \u0440\u0443\u0433\u0430\u043b\u0441\u044f \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u043b\u0435\u0442\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a endpoint.<\/p>\n<p>\u0423\u0440\u043e\u043a: <code><strong>mypy --strict<\/strong><\/code><strong> \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044f\u0445, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0442\u0438\u043f\u044b \u0434\u044b\u0440\u044f\u0432\u044b\u0435<\/strong>. Pydantic + SQLAlchemy \u0434\u0430\u044e\u0442 enough metadata, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435.<\/p>\n<p><strong>2. <\/strong><code><strong>Cannot import name 'async_session'<\/strong><\/code><\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b <code>from app.db import async_session<\/code>, \u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u2014 <code>SessionLocal<\/code>. \u041e\u043f\u044f\u0442\u044c \u2014 \u043b\u043e\u0432\u0438\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c, \u043b\u0438\u0431\u043e \u043b\u0438\u043d\u0442\u0435\u0440\u043e\u043c. \u042f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b.<\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u044f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e dev-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 auto-reload + \u0440\u0443\u0447\u043d\u044b\u0435 curl\u2019\u044b \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u0430 \u0442\u0435\u0441\u0442\u0430\u043c. \u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430 \u043f\u043e\u043d\u044f\u043b: \u043d\u0435\u0442, \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f. \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043b pre-commit hook \u0441 <code>python -m py_compile $(git diff --name-only --cached | grep '\\.py$')<\/code> \u2014 \u0442\u0443\u043f\u043e, \u043d\u043e 80% \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043b\u043e\u0432\u0438\u0442.<\/p>\n<h3>\u0428\u0430\u0433 6: \u0447\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u043b \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u0447\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0444\u0438\u043a\u0441\u0430 \u0430\u0434\u043c\u0438\u043d\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0437\u0430 \u0441\u0443\u0442\u043a\u0438:<\/p>\n<pre><code>\u0422\u043e\u043f \u043e\u0448\u0438\u0431\u043e\u043a:  31  qa6jISTY9WI  Sign in to confirm (\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u0430\u044f)   8  OcY18G8szfI  Private video (\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u0430\u044f)   5  J6420DF-6RU  Age-restricted (\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u0430\u044f)   2  -            HTTPSConnectionPool timeout (\u0438\u043d\u0444\u0440\u0430)  \u2190 \u0432\u043e\u0442 \u043e\u043d\u043e<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u0435 2 timeout\u2019\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438: \u043e\u0431\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u0438 \u0432 \u043e\u0434\u043d\u0443 \u043c\u0438\u043d\u0443\u0442\u0443, \u043e\u0431\u0430 \u043d\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u0435 \u21162. \u041f\u043e\u043b\u0435\u0437 \u0432 <code>docker logs<\/code> \u2014 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0443 \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u0440\u0430\u0437\u043e\u0433\u043d\u0430\u043b\u0441\u044f <code>\/tmp<\/code> (yt-dlp \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <code>.part<\/code> \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0439), \u0438 <code>df<\/code> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b 96%. yt-dlp \u043d\u0435 \u043f\u0430\u0434\u0430\u043b \u044f\u0432\u043d\u043e, \u043e\u043d <em>\u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b<\/em>, \u0438 \u043d\u0430\u0448 timeout 90 \u0441\u0435\u043a \u0435\u0433\u043e \u043e\u0431\u0440\u0435\u0437\u0430\u043b. \u041f\u043e\u0447\u0438\u043d\u0438\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0444\u043e\u043d\u043e\u0432\u044b\u043c cleanup\u2019\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0435 60 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>\u0411\u0435\u0437 bridge\u2019\u0430 \u044f \u0431\u044b \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0448\u0451\u043b. \u0422\u043e\u0447\u043d\u0435\u0435, \u043d\u0430\u0448\u0451\u043b \u0431\u044b \u2014 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0434\u0435\u043b\u044e, \u043a\u043e\u0433\u0434\u0430 \u044e\u0437\u0435\u0440\u044b \u043c\u0430\u0441\u0441\u043e\u0432\u043e \u043f\u043e\u0436\u0430\u043b\u0443\u044e\u0442\u0441\u044f. \u0410 \u0442\u0430\u043a \u2014 \u0437\u0430 \u0447\u0430\u0441.<\/p>\n<h3>\u0428\u0430\u0433 7: \u0447\u0442\u043e \u0435\u0449\u0451 \u0445\u043e\u0447\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c<\/h3>\n<ul>\n<li>\n<p><strong>\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u0441\u043e sources<\/strong>: \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0437\u043d\u0430\u044e \u00ab\u044d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u0430 \u0441 <code>\/api\/info<\/code>\u00bb, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u044e, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e referer, \u043a\u0430\u043a\u043e\u0435 UA, \u043a\u0430\u043a\u0430\u044f IP. \u0414\u043e\u0431\u0430\u0432\u043b\u044e \u2014 \u043d\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0433\u043e\u0434\u0438\u0442\u044c \u0432 \u041f\u0414\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>Auto-retry \u043d\u0430 bot-check<\/strong>: \u0435\u0441\u043b\u0438 <code>Sign in to confirm<\/code> \u22653 \u0440\u0430\u0437 \u0437\u0430 \u043c\u0438\u043d\u0443\u0442\u0443 \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u0432\u044b\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u0438\u0437 round-robin \u043d\u0430 30 \u043c\u0438\u043d\u0443\u0442, \u0434\u0451\u0440\u043d\u0443\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0443 alert. \u0421\u0435\u0439\u0447\u0430\u0441 \u0440\u0443\u043a\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e video_id \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435<\/strong>: \u0447\u0442\u043e\u0431\u044b 31 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430 <code>qa6jISTY9WI<\/code> \u043d\u0435 \u0444\u043b\u0443\u0434\u0438\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u2014 \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 counter\u2019\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>TTL \u043d\u0430 admin_events<\/strong>: \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0451 \u0440\u0430\u0441\u0442\u0451\u0442, \u0447\u0435\u0440\u0435\u0437 \u0433\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 100\u043a \u0441\u0442\u0440\u043e\u043a. \u041f\u043e\u0441\u0442\u0430\u0432\u043b\u044e partition \u043f\u043e \u0434\u043d\u044f\u043c + cleanup &gt;30 \u0434\u043d\u0435\u0439.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0427\u0442\u043e \u0431\u044b \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u043d\u0430\u0447\u0435<\/h3>\n<ol>\n<li>\n<p><strong>\u0421\u0440\u0430\u0437\u0443 \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c, \u0431\u0435\u0437 alert-fatigue \u0441\u0442\u0430\u0434\u0438\u0438.<\/strong> \u042f \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0432 \u043b\u043e\u0433\u0430\u0445 \u043c\u043d\u043e\u0433\u043e content-\u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u043e \u0440\u0435\u0448\u0438\u043b \u00ab\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0443\u0448\u0443 \u0432\u0441\u0451, \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u044e\u00bb. \u041b\u0443\u0447\u0448\u0435 \u0431\u044b\u043b\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0435\u0441\u0442\u044c \u0441 <code>grep -E 'private|unavailable|age' worker.log | wc -l<\/code> \u0438 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0434\u043e\u043b\u044e. \u0421\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043b \u0431\u044b \u0441\u0435\u0431\u0435 \u043e\u0434\u0438\u043d \u0438\u0441\u043f\u043e\u0440\u0447\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0447\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p><strong>Bridge \u0447\u0435\u0440\u0435\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0430 \u043d\u0435 fire-and-forget HTTP.<\/strong> \u0421\u0435\u0439\u0447\u0430\u0441 \u0435\u0441\u043b\u0438 auth-service \u043b\u0435\u0436\u0438\u0442, \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u043c\u043e\u043b\u0447\u0430. \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f Redis (\u0438\u043b\u0438 \u0434\u0430\u0436\u0435 SQLite-WAL \u043e\u0447\u0435\u0440\u0435\u0434\u044c) \u0434\u0430\u043b\u0430 \u0431\u044b at-least-once delivery \u0431\u0435\u0437 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u0430\u0442\u0440\u0430\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435 SQLite.<\/strong> \u042f \u0432\u0437\u044f\u043b SQLite \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u00ab\u0443 \u043d\u0430\u0441 \u0432\u0441\u0451 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435\u00bb. \u0427\u0435\u0440\u0435\u0437 \u043c\u0435\u0441\u044f\u0446 <code>admin_events<\/code> \u0443\u0436\u0435 50\u043a \u0441\u0442\u0440\u043e\u043a, \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e <code>created_at DESC LIMIT 100<\/code> \u0435\u0449\u0451 \u043b\u0435\u0442\u0430\u044e\u0442, \u043d\u043e <code>GROUP BY video_id<\/code> \u0443\u0436\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0434\u0443\u043c\u0430\u0435\u0442. Postgres \u0431\u044b\u043b \u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>TypeScript \u043d\u0430 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0432\u043c\u0435\u0441\u0442\u043e vanilla JS.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b \u0444\u0438\u043b\u044c\u0442\u0440 content\/infra, \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043e\u043f\u0435\u0447\u0430\u0442\u0430\u043b\u0441\u044f \u0432 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u041f\u043e\u0442\u0440\u0430\u0442\u0438\u043b 20 \u043c\u0438\u043d\u0443\u0442 \u043d\u0430 debug. \u0421 TS \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u0431\u044b.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0420\u0435\u0437\u044e\u043c\u0435<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u2014 \u0434\u0432\u0430 \u0441\u043e\u0432\u0435\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435 \u0432\u0435\u0440\u044c\u0442\u0435 \u00ab\u0443 \u043d\u0430\u0441 5% 4xx, \u044d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u00bb, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u043b\u0438 \u044d\u0442\u0438 5% \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u043f\u0443\u0448\u044c\u0442\u0435 \u0430\u0434\u043c\u0438\u043d\u0430\u043c \u0432\u0441\u0451 \u043f\u043e\u0434\u0440\u044f\u0434. Push-fatigue \u0445\u0443\u0436\u0435, \u0447\u0435\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 push\u2019\u0435\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0413\u043e\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1036904\/\">https:\/\/habr.com\/ru\/articles\/1036904\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440. \u042f \u0434\u0435\u043b\u0430\u044e \u043e\u043d\u043b\u0430\u0439\u043d-\u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e, \u0431\u044d\u043a\u0435\u043d\u0434 \u043d\u0430 Python (FastAPI + yt-dlp). \u0417\u0430 \u043c\u0435\u0441\u044f\u0446 \u043d\u0430\u0431\u0440\u0430\u043b\u0438 ~1500 DAU \u0438 \u0443\u043f\u0451\u0440\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0436\u0430\u043b\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u00ab\u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00bb, \u0430 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0437\u0435\u043b\u0451\u043d\u044b\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043b\u0447\u0430 \u0443\u043c\u0438\u0440\u0430\u043b\u0438 \u0432 \u043b\u043e\u0433\u0430\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u0430, \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u0439 \u0436\u0435 \u0440\u0435\u043b\u0438\u0437 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c \u0438\u0437-\u0437\u0430 alert-fatigue.TL;DR\u0423 \u043d\u0430\u0441 3 \u043d\u043e\u0434\u044b: master (FastAPI \u043d\u0430 :443) \u0438 2 worker\u2019\u0430 (Docker, yt-dlp). \u0412\u043e\u0440\u043a\u0435\u0440\u044b \u043f\u0430\u0434\u0430\u043b\u0438 \u0432 unavailable \/ private \/ age-restricted, \u043d\u043e \u044d\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u0434\u043e \u0430\u0434\u043c\u0438\u043d\u043a\u0438 \u2014 \u043e\u043d\u0438 \u0443\u043c\u0438\u0440\u0430\u043b\u0438 \u0432 docker logs, \u0433\u0434\u0435 \u0438\u0445 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u043b.\u0421\u0434\u0435\u043b\u0430\u043b\u0438 bridge: \u0432\u043e\u0440\u043a\u0435\u0440 POST\u2019\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 master \u043f\u043e \/admin\/api\/incidents\/external \u0441 X-Internal-Secret, master \u043f\u0438\u0448\u0435\u0442 \u0432 SQLite (AdminEvent) \u0438 \u0448\u043b\u0451\u0442 push \u0430\u0434\u043c\u0438\u043d\u0430\u043c, \u0435\u0441\u043b\u0438 \u22655 \u043e\u0448\u0438\u0431\u043e\u043a \u0437\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434.\u0421\u0440\u0430\u0437\u0443 \u0436\u0435 \u0441\u043b\u043e\u0432\u0438\u043b\u0438 alert-fatigue: 90% \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u2014 \u044d\u0442\u043e \u00ab\u044e\u0437\u0435\u0440 \u0441\u043a\u0438\u043d\u0443\u043b \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435\/\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043e\u00bb, \u0442\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0448\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0414\u043e\u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 content-vs-infra: \u00ab\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u0435\u00bb \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0436\u0443\u0440\u043d\u0430\u043b \u043f\u0438\u0448\u0435\u043c, \u043d\u043e push \u043d\u0435 \u0434\u0451\u0440\u0433\u0430\u0435\u043c.\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430 \u0430\u0434\u043c\u0438\u043d\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443: 7 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 200. \u0418\u0437 \u043d\u0438\u0445 2 \u2014 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0448 \u0431\u0430\u0433 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 ID \u0432\u0438\u0434\u0435\u043e \u0440\u043e\u043d\u044f\u043b preflight \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u0445). \u041f\u043e\u0447\u0438\u043d\u0438\u043b\u0438 \u0437\u0430 \u0447\u0430\u0441.\u041d\u0438\u0436\u0435 \u2014 \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u0438 \u0447\u0442\u043e \u044f \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u043d\u0430\u0447\u0435.\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442: \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 \u0443\u043c\u0438\u0440\u0430\u043b\u0438\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0430\u044f:[ \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u044e\u0437\u0435\u0440\u0430 ]       \u2502       \u25bc[ master  FastAPI :443 ]\u2500\u2500\u252c\u2500\u2500&gt; \/api\/info  (preflight, yt-dlp &#8212;skip-download)       \u2502                   \u2514\u2500\u2500&gt; \/api\/prepare \u2192 \u0432\u044b\u0431\u043e\u0440 \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u2192 POST \u043a worker&#8217;\u0443       \u2502       \u25bc[ worker1 ] [ worker2 ]   (docker compose, yt-dlp \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0432 \/tmp)       \u2502       \u25bc   \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2192 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0441 master \u043f\u043e \/file\/{task_id}\/api\/info \u0431\u044c\u0451\u0442\u0441\u044f \u0432 YouTube-API \u0447\u0435\u0440\u0435\u0437 yt-dlp \u043f\u0440\u044f\u043c\u043e \u0441 master\u2019\u0430. \u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0435\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \/ \u0443\u0434\u0430\u043b\u0435\u043d\u043e \/ age-gated \u2014 yt-dlp \u0431\u0440\u043e\u0441\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, master \u043b\u043e\u0432\u0438\u0442 \u0435\u0433\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c try\/except \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 400 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.\u0411\u0435\u0434\u0430 \u0432\u043e\u0442 \u0432 \u0447\u0451\u043c: \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u0445\u043e\u0434\u0438\u043b\u043e \u0432 access.log \u0441 status=400 \u0438 \u0432\u0441\u0451. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a. \u041d\u0438\u043a\u0430\u043a\u043e\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438. \u042f \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u00ab4xx \u043e\u043a\u043e\u043b\u043e 5%\u00bb, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u043b, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e 5%.\u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0441\u0442\u043e\u044f\u043b\u0430 \u0446\u0435\u043b\u044c download_error, \u043d\u043e \u043e\u043d\u0430 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0438\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \/api\/prepare \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u044e\u0437\u0435\u0440 \u0443\u0436\u0435 \u043d\u0430\u0436\u0430\u043b \u00ab\u0441\u043a\u0430\u0447\u0430\u0442\u044c\u00bb. \u0410 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0436\u0438\u043b\u0430 \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u0438 preflight (\/api\/info), \u043a\u0443\u0434\u0430 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430 \u0432\u043e\u043e\u0431\u0449\u0435.\u0428\u0430\u0433 1: bridge worker \u2192 master\u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c fire-and-forget POST \u0438\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.# master_main.py \u2014 \u0432\u043d\u0443\u0442\u0440\u0438 \/api\/info exception handlerexcept Exception as e:    msg = str(e)    asyncio.create_task(_report_info_error(req.url, msg))    if &#171;unavailable&#187; in msg.lower() or &#171;copyright&#187; in msg.lower():        raise HTTPException(status_code=400, detail=&#187;\u0412\u0438\u0434\u0435\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043e&#187;)    raise HTTPException(status_code=500, detail=msg)_report_info_error \u0448\u043b\u0451\u0442 POST \u043d\u0430 \/admin\/api\/incidents\/external \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 (auth-service, \u0442\u043e\u0436\u0435 FastAPI \u043d\u0430 :8770, \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0430\u0431\u0438\u043d\u0435\u0442 \u0438 \u0430\u0434\u043c\u0438\u043d\u043a\u0443). \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a X-Internal-Secret \u2014 \u043e\u0431\u0449\u0438\u0439 env-secret, \u0447\u0442\u043e\u0431\u044b \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u043d\u0435 \u043c\u043e\u0433 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0430\u0434\u043c\u0438\u043d\u0441\u043a\u0438\u0439 \u0436\u0443\u0440\u043d\u0430\u043b.async def _report_info_error(url: str, error: str):    try:        async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=2)) as s:            await s.post(                &#171;http:\/\/127.0.0.1:8770\/admin\/api\/incidents\/external&#187;,                json={&#171;source&#187;: &#171;info&#187;, &#171;video_id&#187;: _extract_video_id(url),                      &#171;error&#187;: error[:500], &#171;worker&#187;: &#171;master&#187;},                headers={&#171;X-Internal-Secret&#187;: INTERNAL_SECRET},            )    except Exception:        # bridge \u0443\u043f\u0430\u043b \u2014 \u044d\u0442\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f        pass\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:asyncio.create_task, \u0430 \u043d\u0435 await. \u042e\u0437\u0435\u0440 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0436\u0434\u0430\u0442\u044c, \u043f\u043e\u043a\u0430 bridge \u0434\u043e\u0441\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u0434\u043e \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0415\u0441\u043b\u0438 bridge \u0441\u043b\u043e\u043c\u0430\u043d, \u0444\u0440\u043e\u043d\u0442\u0443 \u044d\u0442\u043e \u0431\u0435\u0437\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e.timeout=2 \u0441\u0435\u043a. \u0418\u043d\u0430\u0447\u0435 \u043f\u043e\u0434\u0432\u0438\u0441\u0448\u0438\u0439 bridge \u0443\u0442\u044f\u043d\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u0432\u0435\u0442 \u044e\u0437\u0435\u0440\u0443.error[:500] \u2014 \u043e\u0431\u0440\u0435\u0437\u0430\u0435\u043c traceback. \u042f \u043e\u0431\u0436\u0451\u0433\u0441\u044f \u2014 yt-dlp \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u044b\u0434\u0430\u0451\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e 8 \u041a\u0411 \u0441 \u0434\u0430\u043c\u043f\u043e\u043c \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0430.except: pass \u0432 bridge \u2014 \u0434\u0430, \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d. \u041d\u043e \u044d\u0442\u043e \u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u044f, \u0430 \u043d\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430. \u0415\u0441\u043b\u0438 bridge \u0440\u043e\u043d\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \/api\/info, \u0443 \u0442\u0435\u0431\u044f \u0434\u044b\u0440\u0430.\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 master\u2019\u0430 \u0435\u0449\u0451 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 bridge \u0432 worker callback (\u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0440\u043a\u0435\u0440 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 master\u2019\u0443 \u2014 \u043c\u044b \u0442\u043e\u0436\u0435 \u043b\u043e\u0432\u0438\u043c status \u0438 \u0448\u043b\u0451\u043c \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0443, \u0435\u0441\u043b\u0438 4xx\/5xx).\u0428\u0430\u0433 2: storage \u0432 master\u0412 auth-service (\u0442\u043e\u0442, \u0447\u0442\u043e \u0430\u0434\u043c\u0438\u043d\u043a\u0430) \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430 AdminEvent:class AdminEvent(Base):    __tablename__ = &#171;admin_events&#187;    id = Column(Integer, primary_key=True)    created_at = Column(DateTime, server_default=func.now())    kind = Column(String(64))         # &#8216;download_error&#8217;, &#8216;login&#8217;, \u0438 \u0442.\u0434.    payload_json = Column(Text)       # \u0441\u044b\u0440\u043e\u0439 JSONEndpoint \u043f\u0440\u043e\u0441\u0442\u043e\u0439:@router.post(&#171;\/admin\/api\/incidents\/external&#187;)async def incidents_external(payload: IncidentPayload, request: Request):    if request.headers.get(&#171;X-Internal-Secret&#187;) != INTERNAL_SECRET:        raise HTTPException(403, &#171;Forbidden&#187;)    async with SessionLocal() as session:        ev = AdminEvent(            kind=&#187;download_error&#187;,            payload_json=json.dumps({                &#171;source&#187;: payload.source,           # &#8216;info&#8217; \/ &#8216;task_status&#8217; \/ &#8230;                &#171;video_id&#187;: payload.video_id,                &#171;error&#187;: payload.error,                &#171;worker&#187;: payload.worker,                &#171;url&#187;: payload.url,            }, ensure_ascii=False),        )        session.add(ev)        await session.commit()    # \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u0431\u0430\u0433 \u2014 \u0441\u043c. \u043d\u0438\u0436\u0435    incidents_svc.report_error(payload.status_code or 500, f&#187;download:{payload.video_id}&#187;)    return {&#171;ok&#187;: True}incidents_svc.report_error \u2014 \u044d\u0442\u043e in-memory \u0441\u0447\u0451\u0442\u0447\u0438\u043a: \u0435\u0441\u043b\u0438 \u0437\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u22655 \u043e\u0448\u0438\u0431\u043e\u043a, \u0434\u0451\u0440\u0433\u0430\u0435\u0442\u0441\u044f push-broadcast \u0430\u0434\u043c\u0438\u043d\u0430\u043c \u0447\u0435\u0440\u0435\u0437 Web Push API.\u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u041e\u0434\u0438\u043d \u0434\u0435\u043d\u044c. \u0414\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0435\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u043f\u0438\u043a\u0430.\u0428\u0430\u0433 3: alert-fatigue\u0412 21:43 \u043c\u043d\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u043f\u043e\u0434\u0440\u044f\u0434 4 push\u2019\u0430: \u00abBurst: 12 download_errors\u00bb. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u0430\u0434\u043c\u0438\u043d\u043a\u0443 \u2014 \u0442\u0430\u043c 47 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0437\u0430 \u043c\u0438\u043d\u0443\u0442\u0443.\u0418\u0437 \u043d\u0438\u0445:31 \u2014 Sign in to confirm you&#8217;re not a bot8 \u2014 Private video. Sign in if you&#8217;ve been granted access5 \u2014 This video is age-restricted and only available on YouTube2 \u2014 Video unavailable. The uploader has not made this video available in your country1 \u2014 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0448\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 (\u0442a\u0439\u043c\u0430\u0443\u0442 \u043d\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u0435)\u0422\u043e \u0435\u0441\u0442\u044c 46 \u0438\u0437 47 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0431\u0430\u0433\u0438, \u044d\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0435\/\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435\/age-gated\/\u0433\u0435\u043e-\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u043e\u043b\u0438\u043a\u0438. \u042d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u042d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0443\u0448\u0438\u0442\u044c.\u0415\u0449\u0451 \u0445\u0443\u0436\u0435: \u043f\u0443\u0448\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435, \u043d\u043e \u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043a \u043d\u0438\u043c \u043f\u0440\u0438\u0432\u044b\u043a. \u0427\u0435\u0440\u0435\u0437 \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u044f \u0431\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442.\u0428\u0430\u0433 4: \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 content vs infra\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043b\u043e\u0431 \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432:err_lower = (payload.error or &#171;&#187;).lower()is_content_error = any(p in err_lower for p in (    &#171;sign in to confirm&#187;,         # bot-check, IP problem (\u043d\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043c\u043e\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442\u0435)    &#171;\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435&#187;, &#171;private video&#187;,    &#171;age-restricted&#187;, &#171;members-only&#187;,    &#171;video unavailable&#187;, &#171;\u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e&#187;, &#171;\u0443\u0434\u0430\u043b\u0435\u043d\u043e&#187;,    &#171;copyright&#187;,    &#171;this video is not available in your country&#187;,))if not is_content_error:    incidents_svc.report_error(payload.status_code or 500, f&#187;download:{payload.video_id}&#187;)return {&#171;ok&#187;: True, &#171;content_error&#187;: is_content_error}\u041a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 admin_events \u2014 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u044b\u0435 (\u0432\u0434\u0440\u0443\u0433 80% \u2014 age-restricted \u0438 \u044f \u0441\u043c\u043e\u0433\u0443 \u043e\u0431\u043e\u0439\u0442\u0438 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 fallback). \u041d\u043e push-burst \u043d\u0435 \u0434\u0451\u0440\u0433\u0430\u044e\u0442.\u0412 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u00ab\u041e\u0448\u0438\u0431\u043a\u0438\u00bb \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0444\u0438\u043b\u044c\u0442\u0440: \u00ab\u0412\u0441\u0435 \/ \u0422\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u0440\u0430 \/ \u0422\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u0435\u00bb. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u0440\u0430.\u041f\u043e\u0447\u0435\u043c\u0443 Sign in to confirm \u044f \u043e\u0442\u043d\u0451\u0441 \u043a \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u043c\u042d\u0442\u043e \u0441\u043f\u043e\u0440\u043d\u043e. Sign in to confirm you&#8217;re not a bot \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e YouTube \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043d\u0430\u0448 IP \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0431\u043e\u0442\u0430. \u042d\u0442\u043e \u043d\u0430\u0448\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435, \u0447\u0442\u043e \u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0431\u044b \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0437\u0430\u043f\u0430\u0441\u043d\u043e\u0439 IP (\u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043a\u0441\u0438-\u043f\u0443\u043b).\u041d\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442\u0435, \u043a\u043e\u0433\u0434\u0430 \u044e\u0437\u0435\u0440 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0448\u0438\u0431\u043a\u0443, \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0430 push\u2019\u043e\u043c \u2014 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e, \u044f \u043d\u0435 \u043f\u043e\u0447\u0438\u043d\u044e \u044d\u0442\u043e \u0440\u0443\u043a\u0430\u043c\u0438 \u0437\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043d\u043e\u0448\u0443 \u043a \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u044b\u043c \u0438 \u0440\u0435\u0448\u0430\u044e \u0447\u0435\u0440\u0435\u0437 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c: \u043c\u0435\u0442\u0440\u0438\u043a\u0430 bot_check_rate \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 &gt;5% \u0437\u0430 \u0447\u0430\u0441 \u2014 \u0442\u043e\u0433\u0434\u0430 \u0443\u0436\u0435 \u0430\u043b\u0435\u0440\u0442. Burst-detection \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0442\u0443\u0442 \u043d\u0435\u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u0435\u043d.\u0428\u0430\u0433 5: \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0435\u0439\u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0434\u0435\u043f\u043b\u043e\u0435 \u0441\u043b\u043e\u0432\u0438\u043b \u0434\u0432\u0435 \u0433\u043b\u0443\u043f\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0438:1. AdminEvent has no attribute &#8216;payload&#8217;\u042f \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b ev.payload = &#8230;, \u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043b\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f payload_json. \u0421\u0442\u0430\u0440\u044b\u0439 \u044f \u0431\u044b \u043e\u0442\u043b\u043e\u0432\u0438\u043b \u044d\u0442\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c, \u043d\u043e FastAPI \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 dev-\u0440\u0435\u0436\u0438\u043c\u0435 \u043d\u0435 \u0440\u0443\u0433\u0430\u043b\u0441\u044f \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u043b\u0435\u0442\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a endpoint.\u0423\u0440\u043e\u043a: mypy &#8212;strict \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044f\u0445, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0442\u0438\u043f\u044b \u0434\u044b\u0440\u044f\u0432\u044b\u0435. Pydantic + SQLAlchemy \u0434\u0430\u044e\u0442 enough metadata, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435.2. Cannot import name &#8216;async_session&#8217;\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b from app.db import async_session, \u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u2014 SessionLocal. \u041e\u043f\u044f\u0442\u044c \u2014 \u043b\u043e\u0432\u0438\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c, \u043b\u0438\u0431\u043e \u043b\u0438\u043d\u0442\u0435\u0440\u043e\u043c. \u042f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b.\u0420\u0430\u043d\u044c\u0448\u0435 \u044f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e dev-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 auto-reload + \u0440\u0443\u0447\u043d\u044b\u0435 curl\u2019\u044b \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u0430 \u0442\u0435\u0441\u0442\u0430\u043c. \u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430 \u043f\u043e\u043d\u044f\u043b: \u043d\u0435\u0442, \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f. \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043b pre-commit hook \u0441 python -m py_compile $(git diff &#8212;name-only &#8212;cached | grep &#8216;\\.py$&#8217;) \u2014 \u0442\u0443\u043f\u043e, \u043d\u043e 80% \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043b\u043e\u0432\u0438\u0442.\u0428\u0430\u0433 6: \u0447\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u043b \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u0447\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430\u041f\u043e\u0441\u043b\u0435 \u0444\u0438\u043a\u0441\u0430 \u0430\u0434\u043c\u0438\u043d\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0437\u0430 \u0441\u0443\u0442\u043a\u0438:\u0422\u043e\u043f \u043e\u0448\u0438\u0431\u043e\u043a:  31  qa6jISTY9WI  Sign in to confirm (\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u0430\u044f)   8  OcY18G8szfI  Private video (\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u0430\u044f)   5  J6420DF-6RU  Age-restricted (\u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043d\u0430\u044f)   2  &#8212;            HTTPSConnectionPool timeout (\u0438\u043d\u0444\u0440\u0430)  \u2190 \u0432\u043e\u0442 \u043e\u043d\u043e\u0422\u0435 2 timeout\u2019\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438: \u043e\u0431\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u0438 \u0432 \u043e\u0434\u043d\u0443 \u043c\u0438\u043d\u0443\u0442\u0443, \u043e\u0431\u0430 \u043d\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u0435 \u21162. \u041f\u043e\u043b\u0435\u0437 \u0432 docker logs \u2014 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0443 \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u0440\u0430\u0437\u043e\u0433\u043d\u0430\u043b\u0441\u044f \/tmp (yt-dlp \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 .part \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0439), \u0438 df \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b 96%. yt-dlp \u043d\u0435 \u043f\u0430\u0434\u0430\u043b \u044f\u0432\u043d\u043e, \u043e\u043d \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b, \u0438 \u043d\u0430\u0448 timeout 90 \u0441\u0435\u043a \u0435\u0433\u043e \u043e\u0431\u0440\u0435\u0437\u0430\u043b. \u041f\u043e\u0447\u0438\u043d\u0438\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0444\u043e\u043d\u043e\u0432\u044b\u043c cleanup\u2019\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0435 60 \u0441\u0435\u043a\u0443\u043d\u0434.\u0411\u0435\u0437 bridge\u2019\u0430 \u044f \u0431\u044b \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0448\u0451\u043b. \u0422\u043e\u0447\u043d\u0435\u0435, \u043d\u0430\u0448\u0451\u043b \u0431\u044b \u2014 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0434\u0435\u043b\u044e, \u043a\u043e\u0433\u0434\u0430 \u044e\u0437\u0435\u0440\u044b \u043c\u0430\u0441\u0441\u043e\u0432\u043e \u043f\u043e\u0436\u0430\u043b\u0443\u044e\u0442\u0441\u044f. \u0410 \u0442\u0430\u043a \u2014 \u0437\u0430 \u0447\u0430\u0441.\u0428\u0430\u0433 7: \u0447\u0442\u043e \u0435\u0449\u0451 \u0445\u043e\u0447\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u0441\u043e sources: \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0437\u043d\u0430\u044e \u00ab\u044d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u0430 \u0441 \/api\/info\u00bb, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u044e, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e referer, \u043a\u0430\u043a\u043e\u0435 UA, \u043a\u0430\u043a\u0430\u044f IP. \u0414\u043e\u0431\u0430\u0432\u043b\u044e \u2014 \u043d\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0433\u043e\u0434\u0438\u0442\u044c \u0432 \u041f\u0414\u043d.Auto-retry \u043d\u0430 bot-check: \u0435\u0441\u043b\u0438 Sign in to confirm \u22653 \u0440\u0430\u0437 \u0437\u0430 \u043c\u0438\u043d\u0443\u0442\u0443 \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u0432\u044b\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u0438\u0437 round-robin \u043d\u0430 30 \u043c\u0438\u043d\u0443\u0442, \u0434\u0451\u0440\u043d\u0443\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0443 alert. \u0421\u0435\u0439\u0447\u0430\u0441 \u0440\u0443\u043a\u0430\u043c\u0438.\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e video_id \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435:&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-480266","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=480266"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480266\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=480266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=480266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=480266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}