exception Handle in ping

This commit is contained in:
BennyThink 2022-04-15 20:12:22 +08:00
parent c7436b8bd1
commit c15348b14a
No known key found for this signature in database
GPG Key ID: 6CD0DBDA5235D481
4 changed files with 12 additions and 8 deletions

View File

@ -1,21 +1,21 @@
pyrogram==1.4.8
pyrogram==1.4.15
tgcrypto==1.2.3
yt-dlp==2022.3.8.2
yt-dlp==2022.4.8
APScheduler==3.9.1
beautifultable==1.0.1
ffmpeg-python==0.2.0
PyMySQL==1.0.2
celery==5.2.3
celery==5.2.6
filetype==1.0.10
flower==1.0.0
psutil==5.9.0
influxdb==5.3.1
beautifulsoup4==4.10.0
beautifulsoup4==4.11.1
fakeredis==1.7.1
supervisor==4.2.4
tgbot-ping==1.0.4
redis==4.1.4
requests==2.27.1
tqdm==4.63.0
tqdm==4.64.0
requests-toolbelt==0.9.1
ffpb==0.4.1

View File

@ -235,7 +235,10 @@ class InfluxDB:
username = os.getenv("FLOWER_USERNAME", "benny")
token = base64.b64encode(f"{username}:{password}".encode()).decode()
headers = {"Authorization": f"Basic {token}"}
return requests.get("https://celery.dmesg.app/dashboard?json=1", headers=headers).json()
r = requests.get("https://celery.dmesg.app/dashboard?json=1", headers=headers)
if r.status_code != 200:
return dict(data=[])
return r.json()
def extract_dashboard_data(self):
self.data = self.get_worker_data()

View File

@ -187,7 +187,8 @@ class Detector:
"Code is updated",
'Retrying "messages.GetMessages"',
"OSError: Connection lost",
"[Errno -3] Try again"
"[Errno -3] Try again",
"MISCONF",
]
for indicator in indicators:
if indicator in self.logs:

View File

@ -161,7 +161,7 @@ def ping_handler(client: "Client", message: "types.Message"):
else:
bot_info = get_runtime("ytdlbot_ytdl_1", "YouTube-dl")
if message.chat.username == OWNER:
stats = bot_text.ping_worker()
stats = bot_text.ping_worker()[:1000]
client.send_document(chat_id, Redis().generate_file(), caption=f"{bot_info}\n\n{stats}")
else:
client.send_message(chat_id, f"{bot_info}")