限制 bot 容器资源占用

This commit is contained in:
2569718930@qq.com
2026-05-25 22:31:42 +08:00
parent 5d0d1e2673
commit a80280732c
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -40,10 +40,16 @@ TELEGRAM_QUERY_TOPIC_ID=
TELEGRAM_QUERY_TOPIC_MAP=
POLYWEATHER_BOT_GROUP_INVITE_URL=
POLYWEATHER_APP_URL=https://polyweather-pro.vercel.app
# High-frequency airport push loop. Keep this at 1 on shared 1CPU VPS.
# High-frequency airport push loop. Keep workers at 1 on shared VPS.
TELEGRAM_AIRPORT_PUSH_ENABLED=true
TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC=60
TELEGRAM_AIRPORT_PUSH_MAX_WORKERS=1
# Docker-only safety limits for the bot service.
POLYWEATHER_BOT_CPUS=0.75
POLYWEATHER_BOT_MEM_LIMIT=768m
POLYWEATHER_BOT_MEMSWAP_LIMIT=1g
POLYWEATHER_BOT_AIRPORT_PUSH_INTERVAL_SEC=180
POLYWEATHER_BOT_AIRPORT_PUSH_MAX_WORKERS=1
########################################
# 3) Weather + cache
+7 -1
View File
@@ -9,6 +9,13 @@ services:
<<: *polyweather-base
container_name: polyweather_bot
restart: unless-stopped
cpus: "${POLYWEATHER_BOT_CPUS:-0.75}"
mem_limit: "${POLYWEATHER_BOT_MEM_LIMIT:-768m}"
memswap_limit: "${POLYWEATHER_BOT_MEMSWAP_LIMIT:-1g}"
pids_limit: 256
environment:
TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC: "${POLYWEATHER_BOT_AIRPORT_PUSH_INTERVAL_SEC:-180}"
TELEGRAM_AIRPORT_PUSH_MAX_WORKERS: "${POLYWEATHER_BOT_AIRPORT_PUSH_MAX_WORKERS:-1}"
volumes:
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/var/lib/polyweather
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/app/data
@@ -36,4 +43,3 @@ services:
interval: 30s
timeout: 5s
retries: 3