Fix timing of async functions and make histogram finer at lower ranges
Some checks failed
Build Docker image / test (push) Successful in 4m34s
Build Docker image / build (push) Has been cancelled

This commit is contained in:
Roman Krček
2025-05-13 18:14:36 +02:00
parent 020a6271cf
commit b01a799a94
3 changed files with 8 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import re
from datetime import datetime
from hashlib import sha256
from prometheus_async.aio import time as async_time
from pyrogram import Client
from pyrogram.types import Message
from tiktok_downloader import snaptik
@@ -59,7 +60,7 @@ def get_user_folder(message: Message) -> os.path:
return user_folder
@DOWNLOAD_DURATION.labels(service='telegram').time()
@async_time(DOWNLOAD_DURATION.labels(service='telegram'))
async def handle_media_message_contents(client: Client,
message: Message):
"""Detect what kind of media is being sent over from the user.
@@ -132,7 +133,7 @@ async def check_if_tt_downloaded(tt_hash: str) -> bool:
return tt_hash in all_tt_hashes
@DOWNLOAD_DURATION.labels(service='tiktok').time()
@async_time(DOWNLOAD_DURATION.labels(service='tiktok'))
async def download_tt_video(url: str) -> str:
"""Downloads tiktok video from a given URL.
Makes sure the video integrity is correct."""