Phase 8: widgets and polish
- Live job card widget (progress bar, in-widget cancel via widget_query) and live invoice widget (QR drawn from a bitmap, countdown, paid state), Bot API 10.4 sendWidget, private chats only - Automatic fallback to the ordinary message when sendWidget fails, with a breaker that pauses widgets after repeated failures or on servers without the method; TELEGRAM_WIDGETS - Prometheus metrics on the core (/metrics) and on every worker: queue depth and wait, slots, heartbeats, job outcomes, errors per site, deliveries, cache, invoices, Lightning, ledger check, widgets - Example Prometheus config and alert rules, Caddyfile, dashboard notes - Load test: cmd/loadtest and deploy/loadtest (make loadtest) - Browser check of the widgets' HTML, including decoding a drawn QR - docs/DEPLOY.md (production in under an hour) and docs/MONITORING.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f1f9c6156c
commit
3c153af97f
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# A yt-dlp stand-in for load tests. It never touches the network. Every URL
|
||||
# is its own video (the ID is a checksum of the URL), so the cache only
|
||||
# helps where the load test asks for the same link twice.
|
||||
#
|
||||
# LOAD_SIZE bytes per file (default 2000000)
|
||||
# LOAD_TIME seconds per download (default 2)
|
||||
# LOAD_PROBE seconds per lookup (default 0.2)
|
||||
set -u
|
||||
args=("$@")
|
||||
dir=""
|
||||
probe=0
|
||||
url="${args[$((${#args[@]} - 1))]}"
|
||||
for ((i = 0; i < ${#args[@]}; i++)); do
|
||||
case "${args[$i]}" in
|
||||
-P) dir="${args[$((i + 1))]}" ;;
|
||||
-J) probe=1 ;;
|
||||
--version) echo "2026.10.26"; exit 0 ;;
|
||||
-U|--update) echo "yt-dlp is up to date"; exit 0 ;;
|
||||
esac
|
||||
done
|
||||
id=$(printf '%s' "$url" | cksum | cut -d' ' -f1)
|
||||
size=${LOAD_SIZE:-2000000}
|
||||
|
||||
if [[ $probe -eq 1 ]]; then
|
||||
sleep "${LOAD_PROBE:-0.2}"
|
||||
echo '{"id": "v'"$id"'", "title": "Load test '"$id"'", "extractor": "loadtest", "extractor_key": "Loadtest", "webpage_url": "'"$url"'", "duration": 60, "uploader": "Load", "is_live": false, "formats": [{"format_id": "a", "ext": "m4a", "vcodec": "none", "acodec": "mp4a.40.2", "filesize": '"$((size / 4))"'}, {"format_id": "v", "ext": "mp4", "vcodec": "avc1", "acodec": "mp4a.40.2", "height": 720, "width": 1280, "filesize": '"$size"'}]}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo 'INFO|{"id": "v'"$id"'", "title": "Load test '"$id"'", "duration": 60, "extractor": "loadtest", "extractor_key": "Loadtest", "uploader": "Load", "is_live": false}'
|
||||
echo "[download] Destination: $dir/media.mp4"
|
||||
steps=4
|
||||
for ((s = 1; s <= steps; s++)); do
|
||||
sleep "$(awk "BEGIN{print ${LOAD_TIME:-2}/$steps}")"
|
||||
echo "DLP|downloading|$((size * s / steps))|$size|NA"
|
||||
done
|
||||
echo "DLP|finished|$size|$size|NA"
|
||||
head -c "$size" /dev/zero > "$dir/media.mp4"
|
||||
echo 'RESULT|{"width": 1280, "height": 720, "duration": 60, "ext": "mp4", "filepath": "'"$dir/media.mp4"'"}'
|
||||
Reference in New Issue
Block a user