perf: 添加超时处理以防止上传参数请求挂起并优化上传参数事件分发
This commit is contained in:
parent
a2f858e7b6
commit
0081140b63
@ -1210,6 +1210,7 @@ export default {
|
||||
this.onmessage(msg.data)
|
||||
break
|
||||
case 'getUploadParams':
|
||||
// 接收到 getUploadParams 事件,分发 onUploadParams 事件,携带上传参数
|
||||
this.$store.dispatch('updateMessage', {
|
||||
event: 'onUploadParams',
|
||||
data: this.getUploadParams(),
|
||||
|
||||
@ -327,7 +327,7 @@ export default {
|
||||
try {
|
||||
const waitForParams = new Promise((resolve, reject) => {
|
||||
this.resolveFilesAddedPromise = resolve;
|
||||
// 添加超时以防止未收到响应时挂起
|
||||
// 添加超时以防止未收到响应时挂起,如果服务端没有及时返回上传参数,则取消上传
|
||||
setTimeout(() => reject(new Error('Timeout waiting for upload parameters')), 3000);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user