From a80280732c2f3692833da2862305e2a3c29cd006 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 25 May 2026 22:31:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=20bot=20=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 8 +++++++- docker-compose.yml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index c9e25631..a25e5bb6 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index af3d62b0..9e400acd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 -