[英]How to increase timeout while uploading on the Sanic framework?
我在 Sanic 中有一種上傳文件的方法。 有時我的文件很大或者服務器和客戶端之間的連接很差所以,在這種情況下,我會丟失我的請求,因為客戶端發生超時異常。 我想在特定方法之上增加超時。
# I want to define set timeout period here
# @set_imeout(4 * 60)
@song.route('/upload', methods=["POST"])
@is_authenticated()
@required_roles(['cafe'])
@jsonify
async def process_upload(request):
# upload method
do something for upload
從 Sanic 20.3 開始,這是不可能的,但計划在未來版本中使用此類功能。
https://github.com/huge-success/sanic/pull/1791允許在流處理程序中調整請求最大大小,並在有 I/O 時重置請求超時,以便長時間上傳不會超時。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.