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:
parent
b1af0b2244
commit
e5a5d7ded9
@ -259,14 +259,17 @@ class ProjectStore implements IProjectStore {
|
|||||||
environment: string,
|
environment: string,
|
||||||
projects: string[],
|
projects: string[],
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const rows = projects.map(async (projectId) => {
|
const rows = await Promise.all(
|
||||||
|
projects.map(async (projectId) => {
|
||||||
const project = await this.get(projectId);
|
const project = await this.get(projectId);
|
||||||
return {
|
return {
|
||||||
project_id: projectId,
|
project_id: projectId,
|
||||||
environment_name: environment,
|
environment_name: environment,
|
||||||
change_request_enabled: project.changeRequestsEnabled || false,
|
change_request_enabled:
|
||||||
|
project.changeRequestsEnabled || false,
|
||||||
};
|
};
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
await this.db('project_environments')
|
await this.db('project_environments')
|
||||||
.insert(rows)
|
.insert(rows)
|
||||||
|
Loading…
Reference in New Issue
Block a user