mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-23 09:39:48 +02:00
fix: add missing await
This commit is contained in:
@@ -204,8 +204,13 @@ export default class AnonymizedFile {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const out = await this.repository.source?.getFileContent(this);
|
const out = await this.repository.source?.getFileContent(this);
|
||||||
|
if (
|
||||||
|
!this.repository.model.isReseted ||
|
||||||
|
this.repository.status != RepositoryStatus.READY
|
||||||
|
) {
|
||||||
this.repository.model.isReseted = false;
|
this.repository.model.isReseted = false;
|
||||||
await this.repository.updateStatus(RepositoryStatus.READY);
|
await this.repository.updateStatus(RepositoryStatus.READY);
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
} finally {
|
} finally {
|
||||||
span.end();
|
span.end();
|
||||||
|
|||||||
+2
-1
@@ -18,7 +18,8 @@ export default class Conference {
|
|||||||
*/
|
*/
|
||||||
async updateStatus(status: ConferenceStatus, errorMessage?: string) {
|
async updateStatus(status: ConferenceStatus, errorMessage?: string) {
|
||||||
this._data.status = status;
|
this._data.status = status;
|
||||||
return this._data.save();
|
await this._data.save();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-3
@@ -173,7 +173,7 @@ export default class PullRequest {
|
|||||||
async countView() {
|
async countView() {
|
||||||
this._model.lastView = new Date();
|
this._model.lastView = new Date();
|
||||||
this._model.pageView = (this._model.pageView || 0) + 1;
|
this._model.pageView = (this._model.pageView || 0) + 1;
|
||||||
return this._model.save();
|
await this._model.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -185,7 +185,7 @@ export default class PullRequest {
|
|||||||
this._model.status = status;
|
this._model.status = status;
|
||||||
this._model.statusDate = new Date();
|
this._model.statusDate = new Date();
|
||||||
this._model.statusMessage = statusMessage;
|
this._model.statusMessage = statusMessage;
|
||||||
return this._model.save();
|
await this._model.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,7 +223,7 @@ export default class PullRequest {
|
|||||||
this._model.pullRequest.mergedDate = undefined;
|
this._model.pullRequest.mergedDate = undefined;
|
||||||
this._model.pullRequest.state = "closed";
|
this._model.pullRequest.state = "closed";
|
||||||
this._model.pullRequest.draft = false;
|
this._model.pullRequest.draft = false;
|
||||||
return Promise.all([this._model.save()]);
|
await this._model.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-2
@@ -304,7 +304,7 @@ export default class Repository {
|
|||||||
this._model.lastView = new Date();
|
this._model.lastView = new Date();
|
||||||
this._model.pageView = (this._model.pageView || 0) + 1;
|
this._model.pageView = (this._model.pageView || 0) + 1;
|
||||||
if (!isConnected) return this.model;
|
if (!isConnected) return this.model;
|
||||||
return this._model.save();
|
await this._model.save();
|
||||||
} finally {
|
} finally {
|
||||||
span.end();
|
span.end();
|
||||||
}
|
}
|
||||||
@@ -328,7 +328,7 @@ export default class Repository {
|
|||||||
this._model.statusDate = new Date();
|
this._model.statusDate = new Date();
|
||||||
this._model.statusMessage = statusMessage;
|
this._model.statusMessage = statusMessage;
|
||||||
if (!isConnected) return this.model;
|
if (!isConnected) return this.model;
|
||||||
return this._model.save();
|
await this._model.save();
|
||||||
} finally {
|
} finally {
|
||||||
span.end();
|
span.end();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -48,7 +48,8 @@ router.get(
|
|||||||
}
|
}
|
||||||
// cache the file for 5min
|
// cache the file for 5min
|
||||||
res.header("Cache-Control", "max-age=300");
|
res.header("Cache-Control", "max-age=300");
|
||||||
await Promise.all([repo.countView(), f.send(res)]);
|
await repo.countView();
|
||||||
|
f.send(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return handleError(error, res, req);
|
return handleError(error, res, req);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user