Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上传大文件超时问题如何解决? || How to solve the timeout problem of uploading large files? #1723

Open
DickyNet opened this issue Nov 3, 2023 · 4 comments

Comments

@DickyNet
Copy link

DickyNet commented Nov 3, 2023

DESC

ENV

OS Platform:windows 11

Node.js Version: Node.js 16

ThinkJS Version: 3.2.13

code

// your code here

error message

// your error message here

more description

// your detail description
如题,上传大文件时,比如1G的,本地测试上传2分多钟后就停止响应了


DESC

ENV

OS Platform:windows 11

Node.js Version: Node.js 16

ThinkJS Version: 3.2.13

code

// your code here

error message

// your error message here

more description

// your detail description
As mentioned, when uploading large files, such as 1G, the local test upload stopped responding after more than 2 minutes.

@github-actions github-actions bot changed the title 上传大文件超时问题如何解决? 上传大文件超时问题如何解决? || How to solve the timeout problem of uploading large files? Nov 3, 2023
@DickyNet
Copy link
Author

DickyNet commented Nov 3, 2023

试过这中间件设置超时时间 @uswitch/koa-timeout 报错:TypeError: timeout is not a function

@DickyNet
Copy link
Author

DickyNet commented Nov 3, 2023

const instance = new Application({
ROOT_PATH: __dirname,
APP_PATH: path.join(__dirname, 'app'),
watcher: watcher,
transpiler: [babel, {
presets: ['think-node']
}],
notifier: notifier.notify.bind(notifier),
env: 'development'
});

instance.use(timeout(1000));
instance.run();

@lizheming
Copy link
Contributor

如何引入中间件 https://thinkjs.org/zh-cn/doc/3.0/middleware.html#toc-3ad

@DickyNet
Copy link
Author

DickyNet commented Nov 6, 2023

如何引入中间件 https://thinkjs.org/zh-cn/doc/3.0/middleware.html#toc-3ad

@uswitch/koa-timeout 问题是这个中间件没有配置options的地方,超时参数该怎么设置呢?

const {timeout} = require('@uswitch/koa-timeout');

module.exports = [
{
handle: timeout,
options: {
}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants