バックエンドのテストの改善 (#11978)

* Update utils.ts

* no async executer
This commit is contained in:
FineArchs 2023-10-07 12:25:16 +09:00 committed by GitHub
parent 93bd34113c
commit d6ef28d4ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -301,12 +301,14 @@ export const uploadFile = async (user?: UserToken, { path, name, blob }: UploadO
}; };
export const uploadUrl = async (user: UserToken, url: string) => { export const uploadUrl = async (user: UserToken, url: string) => {
let file: any; let resolve: unknown;
const file = new Promise(ok => resolve = ok);
const marker = Math.random().toString(); const marker = Math.random().toString();
const ws = await connectStream(user, 'main', (msg) => { const ws = await connectStream(user, 'main', (msg) => {
if (msg.type === 'urlUploadFinished' && msg.body.marker === marker) { if (msg.type === 'urlUploadFinished' && msg.body.marker === marker) {
file = msg.body.file; ws.close();
resolve(msg.body.file);
} }
}); });
@ -316,9 +318,6 @@ export const uploadUrl = async (user: UserToken, url: string) => {
force: true, force: true,
}, user); }, user);
await sleep(7000);
ws.close();
return file; return file;
}; };