Update stuff
This commit is contained in:
parent
0254e42b9c
commit
553ba9db9a
40 changed files with 7343 additions and 717 deletions
|
@ -10,17 +10,17 @@ function randomID() {
|
|||
return rand;
|
||||
}
|
||||
|
||||
function* checkId(Files, fileId, attempts) {
|
||||
async function checkId(Files, fileId, attempts) {
|
||||
if (attempts > 10) {
|
||||
return false;
|
||||
}
|
||||
const file = yield models.file.findById(fileId);
|
||||
const file = await models.file.findById(fileId);
|
||||
if (file === null) {
|
||||
return fileId;
|
||||
}
|
||||
return checkId(randomID(), ++attempts); // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
export default function* (Files) {
|
||||
return yield checkId(Files, randomID(), 0);
|
||||
export default function (Files) {
|
||||
return checkId(Files, randomID(), 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue