vvzvlad
3c2b4ce544
perf(downloads): implement concurrent download queue with semaphore limiting and retry logic
...
Add queue-based background download system to improve performance and reliability:
- Introduce DOWNLOAD_SEMAPHORE to limit concurrent downloads to 3
- Add asyncio.Queue (maxsize 100) with dedicated worker for background processing
- Implement safe_get_messages and safe_download_media wrappers with timeout protection (30s and 120s)
- Add retry logic for KeyError auth failures with 5s backoff
- Replace synchronous sequential downloads with asynchronous queued processing
- Prevent event loop blocking by queuing files instead of immediate download
2026-01-01 14:14:26 +03:00
vvzvlad
deacb8b9a0
refactor rss_generator: offload HTML concatenation and sanitization to asyncio.to_thread to improve CPU performance and prevent event loop blocking
2025-09-15 12:16:53 +03:00
vvzvlad
68a2dbfa04
refactor api_server and post_parser: implement asynchronous JSON file operations with locking mechanism to ensure thread safety, and streamline media file ID persistence logic
2025-09-13 20:47:16 +03:00
vvzvlad
1464ea326e
refactor api_server: streamline RSS feed generation by consolidating error handling and removing redundant loop structure
2025-09-13 00:06:36 +03:00
vvzvlad
778aa04904
refactor api_server: implement asynchronous file I/O using asyncio.to_thread for JSON operations, add global python-magic instance for MIME type detection, and enhance delayed file deletion documentation
2025-09-12 23:50:52 +03:00
vvzvlad
43516d6dab
refactor api_server and TelegramClient: remove force_exit function and replace with sys.exit for process termination, update restart logic to use SIGTERM instead of SIGKILL for graceful shutdown
2025-06-10 15:03:09 +03:00
vvzvlad
521c3dc394
implement forceful termination in api_server and TelegramClient: add force_exit function for immediate process shutdown, update SIGTERM handler for forceful exit, and adjust restart logic in connection_handler to use SIGKILL
2025-06-10 14:28:51 +03:00
vvzvlad
d3366ca7ef
refactor tg_cache: update _get_history_from_cache to use max_age_hours instead of max_age_seconds, adjust cache expiration logic accordingly, and remove cache_ttl parameter from cached_get_chat_history
2025-06-10 14:17:16 +03:00
vvzvlad
d6c3725b02
implement graceful shutdown in api_server: add SIGTERM handler for proper termination and enhance error handling for server startup issues
2025-06-10 14:06:56 +03:00
vvzvlad
2c9ebf139f
refactor connection_handler in TelegramClient: increase wait time to 5 seconds before restart, implement process termination and forking for more reliable restarts
2025-06-10 03:58:33 +03:00
vvzvlad
688b9e1927
refactor tg_cache: update cache file naming convention to use a simpler format by removing '_history' from filename
2025-06-10 03:52:17 +03:00
vvzvlad
0dd4460e35
refactor tg_cache: simplify cache file path generation by removing limit from filename and updating related cache functions
2025-06-10 03:51:51 +03:00
vvzvlad
14081a3d44
refactor rss_generator and tg_cache: replace cached_get_chat with direct client.get_chat calls, update message caching logic to handle limits, and improve cache file naming for message history
2025-06-10 03:48:08 +03:00
vvzvlad
223ae57929
add delay in connection_handler to ensure resources are freed before process restart
2025-06-10 03:38:33 +03:00
vvzvlad
0f992bf3a8
enhance cache expiration logic in _get_from_cache: add randomness to max age check for improved cache validity
2025-06-10 03:28:43 +03:00
vvzvlad
c94090c4b5
update _on_disconnect method in TelegramClient: change to async for better handling of disconnections
2025-06-10 03:25:54 +03:00
vvzvlad
95361be6f4
refactor tg_cache: change debug logs to info level for cache operations to enhance log clarity
2025-06-10 03:24:22 +03:00
vvzvlad
b7a8f4f60d
refactor requirements and rss_generator: replace direct get_chat calls with cached_get_chat for improved performance and update requirements.txt to uncomment Kurigram
2025-06-10 02:40:23 +03:00
vvzvlad
0999e86f2b
add timing logs for RSS and HTML generation in api_server and rss_generator
2025-04-27 18:40:31 +04:00
vvzvlad
be28a11db6
implement connection handling in TelegramClient: add disconnect tracking and application restart on multiple disconnections
2025-04-27 18:31:29 +04:00
vvzvlad
f499dc56a7
refactor api_server: comment out redundant log for cached media files
2025-04-27 18:22:31 +04:00
vvzvlad
45e9ac7a1e
refactor post_parser: add line breaks for improved readability in post content
2025-04-27 13:06:39 +04:00
vvzvlad
e0bb640a73
refactor post_parser: enhance post text and poll formatting, improve HTML structure
2025-04-26 13:15:03 +04:00
vvzvlad
508be049d9
refactor post_parser: streamline content body construction for improved readability
2025-04-26 12:55:38 +04:00
vvzvlad
36236d4407
refactor post_parser: clean up whitespace and improve PDF placeholder handling
2025-04-26 12:52:18 +04:00
vvzvlad
1bd36b32d8
refactor post_parser: wrap media content in a div for better HTML structure
2025-04-26 12:51:37 +04:00
vvzvlad
c340d22fc4
improve error logging
2025-04-26 12:46:22 +04:00
vvzvlad
721302d2e6
oops
2025-04-26 12:42:27 +04:00
vvzvlad
b9d5e839df
refactor post_parser and rss_generator:move media in body render
2025-04-26 12:38:52 +04:00
vvzvlad
e9949a7eab
update pylint configurations in test
2025-04-26 02:34:08 +04:00
vvzvlad
58253e15e0
add test for get_all_possible_flags
2025-04-26 02:31:16 +04:00
vvzvlad
422a3925ff
fix bug
2025-04-25 16:59:21 +04:00
vvzvlad
db0d1a6dc2
refactor _generate_html_body to streamline reply info handling and improve logging
2025-04-20 19:07:30 +03:00
vvzvlad
5c34d62c11
EPIC: support REPLY_TO in rss
2025-04-19 04:49:01 +03:00
vvzvlad
80d6cc5d5a
add line break in debug HTML
2025-04-19 04:33:47 +03:00
vvzvlad
65a69ed37a
refactoring
2025-04-19 04:32:44 +03:00
vvzvlad
4e1987983f
refactoring
2025-04-19 04:11:02 +03:00
vvzvlad
2f7f524e83
remove unnecessary line breaks in forwarded message HTML output
2025-04-19 04:03:14 +03:00
vvzvlad
c2bbf72b07
refactor _format_forward_info to handle multiple forward cases and improve logging
2025-04-19 04:01:52 +03:00
vvzvlad
5d4951aecd
update comment in post_parser.py to clarify main cut logic
2025-04-19 03:55:03 +03:00
vvzvlad
3ab2027c4c
add calls map
2025-04-19 03:52:46 +03:00
vvzvlad
1e283c4249
fix bug
2025-04-19 03:50:33 +03:00
vvzvlad
97ad18e9d4
remove unused
2025-04-19 00:01:21 +03:00
vvzvlad
ce39431998
move import
2025-04-18 23:34:26 +03:00
vvzvlad
386e7e8ce4
improve logging
2025-04-18 23:33:47 +03:00
vvzvlad
26744e3699
refactoring
2025-04-18 23:02:29 +03:00
vvzvlad
d2870bc0f6
add youtube title
2025-04-18 22:58:25 +03:00
vvzvlad
d0584d4525
more logging
2025-04-18 21:52:17 +03:00
vvzvlad
ba20f2ee02
add logs
2025-04-18 21:43:56 +03:00
vvzvlad
87822c0d51
add message id debug
2025-04-18 21:34:41 +03:00