6 hours ago
I'm working on a webiste that uploads video to backend and backend sends that video to telegram. I'm dividing video into chunks of 512kb and send backend to send the chunk to telegram so that my backend never loads entire video in memory or storage. This approach works with small videos but when I upload an actual video that is around 500mb the railway timesout my request, in my investigation I found that after 15 minutes railway disconect request so is there a way I can increase it? For example upgrading to a plan?
8 Replies
6 hours ago
There is unfortunately no way to increase it but you can solve this using multipart uploads (meaning sending chunks in independent http requests). That is industry standard for files above 100mb. You could also use websockets instead, that is another workaround.
6 hours ago
By the way, out of curiosity, isn't telegram's file upload limit 50mb? Wouldn't a 500mb video surpass that limit anyway?
The multipart upload isn't the solution to what is causing timeout in my case. What makes railway to timeout is the telegram api taking more than 15 minutes to upload a single chunk and respond to my backend, this makes railway to timeout.
I gotta find another solution maybe disconecting request after ten minutes and saving last success chunk index so that I can request frontend to send file from the last success chunk index to end of the file
You can upload upto 2gb size files from your code to telegram using the WTelegramClient nuget package and in my case size isn't a problem since I am sending chunks of 512kb to telegram and instantly deleting chunk from memory of backend and when the telegram recives the final chunk, telegram constructs video and send in the channel. Making my backend to never load entire video in memory or storage
6 hours ago
You're saying the telegram api is taking more than 15 minutes to upload 512kb?
Sometimes yes and I want to confirm the actual time limit, because I saw 5 minutes in a post in help channel and claude says 15 minutes, because depending on the actual request time out time I will write code
an hour ago
It's definitely 15 minutes
an hour ago
Yep, 15 minutes. It was 5 minutes years ago.