1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

Fix async issue (#2387)

Currently rows were returned as a list of promise, but we need to await
for them.
This commit is contained in:
sjaanus 2022-11-10 13:27:09 +01:00 committed by GitHub
parent b1af0b2244
commit e5a5d7ded9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,14 +259,17 @@ class ProjectStore implements IProjectStore {
environment: string,
projects: string[],
): Promise<void> {
const rows = projects.map(async (projectId) => {
const rows = await Promise.all(
projects.map(async (projectId) => {
const project = await this.get(projectId);
return {
project_id: projectId,
environment_name: environment,
change_request_enabled: project.changeRequestsEnabled || false,
change_request_enabled:
project.changeRequestsEnabled || false,
};
});
}),
);
await this.db('project_environments')
.insert(rows)