Fix timing of async functions and make histogram finer at lower ranges
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user