Check auction status only if deployments don't exist
This commit is contained in:
parent
ed2badebb6
commit
e45cc45f38
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
import { DeepPartial, FindOptionsWhere, IsNull } from 'typeorm';
|
import { DeepPartial, FindOptionsWhere, IsNull, Not } from 'typeorm';
|
||||||
import { Octokit, RequestError } from 'octokit';
|
import { Octokit, RequestError } from 'octokit';
|
||||||
|
|
||||||
import { OAuthApp } from '@octokit/oauth-app';
|
import { OAuthApp } from '@octokit/oauth-app';
|
||||||
@ -275,14 +275,15 @@ export class Service {
|
|||||||
* Calls the createDeploymentFromAuction method for deployments with completed auctions
|
* Calls the createDeploymentFromAuction method for deployments with completed auctions
|
||||||
*/
|
*/
|
||||||
async checkAuctionStatus(): Promise<void> {
|
async checkAuctionStatus(): Promise<void> {
|
||||||
const projects = await this.db.getProjects({
|
const allProjects = await this.db.getProjects({
|
||||||
where: {
|
where: {
|
||||||
deployments: {
|
auctionId: Not(IsNull()),
|
||||||
applicationDeploymentRequestId: IsNull()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
relations: ['deployments'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const projects = allProjects.filter(project => project.deployments.length === 0);
|
||||||
|
|
||||||
const auctionIds = projects.map((project) => project.auctionId);
|
const auctionIds = projects.map((project) => project.auctionId);
|
||||||
const completedAuctionIds = await this.registry.getCompletedAuctionIds(auctionIds);
|
const completedAuctionIds = await this.registry.getCompletedAuctionIds(auctionIds);
|
||||||
|
|
||||||
@ -298,6 +299,7 @@ export class Service {
|
|||||||
await this.db.updateProjectById(project.id!, {
|
await this.db.updateProjectById(project.id!, {
|
||||||
deployerLrn: deployerLrns
|
deployerLrn: deployerLrns
|
||||||
})
|
})
|
||||||
|
|
||||||
for (const deployer of deployerLrns) {
|
for (const deployer of deployerLrns) {
|
||||||
await this.createDeploymentFromAuction(project, deployer);
|
await this.createDeploymentFromAuction(project, deployer);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user