Skip to content

Commit 06f4980

Browse files
chore(merge): merge develop into main
2 parents 145d879 + 89d1397 commit 06f4980

File tree

4 files changed

+74
-34
lines changed

4 files changed

+74
-34
lines changed

apps/worker/sync/src/app/processors/sync-ranking/ranking-sync.ts

+15-13
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,10 @@ export class RankingSyncer {
306306
if (places.has(foundPlayer.id)) {
307307
const place = places.get(foundPlayer.id);
308308

309-
place[type] = points.Level;
309+
// place[type] = points.Level; // disabled, BVL uploads this manually
310310
place[`${type}Points`] = points.Totalpoints;
311311
place[`${type}Rank`] = points.Rank;
312+
await place.save({ transaction: args.transaction });
312313
} else {
313314
places.set(
314315
foundPlayer.id,
@@ -325,15 +326,16 @@ export class RankingSyncer {
325326
);
326327
}
327328

328-
if (publication.usedForUpdate === false && foundPlayer.rankingLastPlaces != null) {
329-
const place = foundPlayer.rankingLastPlaces.find(
330-
(r) => r.systemId === ranking.system.id,
331-
);
332-
if (place?.[type] != null && place[type] !== points.Level) {
333-
place[type] = points.Level;
334-
await place.save({ transaction: args.transaction });
335-
}
336-
}
329+
// disabled, BVL uploads this manually
330+
// if (publication.usedForUpdate === false && foundPlayer.rankingLastPlaces != null) {
331+
// const place = foundPlayer.rankingLastPlaces.find(
332+
// (r) => r.systemId === ranking.system.id,
333+
// );
334+
// if (place?.[type] != null && place[type] !== points.Level) {
335+
// place[type] = points.Level;
336+
// await place.save({ transaction: args.transaction });
337+
// }
338+
// }
337339
}
338340
};
339341

@@ -505,9 +507,9 @@ export class RankingSyncer {
505507

506508
// For now we only check if it's the last update
507509

508-
const lastPublication = visiblePublications.slice()?.sort(
509-
(a, b) => b.date.valueOf() - a.date.valueOf(),
510-
)?.[0];
510+
const lastPublication = visiblePublications
511+
.slice()
512+
?.sort((a, b) => b.date.valueOf() - a.date.valueOf())?.[0];
511513

512514
if (lastPublication == null) {
513515
return;

libs/backend/orchestrator/src/orchestrators/base.orchestrator.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,23 @@ export class OrchestratorBase implements OnModuleInit {
1616

1717
constructor(
1818
protected readonly serviceName: Services,
19-
protected readonly configSerivce: ConfigService<ConfigType>,
19+
protected readonly configService: ConfigService<ConfigType>,
2020
private readonly gateway: EventsGateway,
2121
private readonly queue: Queue,
2222
private readonly renderService: RenderService,
2323
) {
24-
const configuredTimeout = this.configSerivce.get<string>('RENDER_WAIT_TIME');
24+
const configuredTimeout = this.configService.get<string>('RENDER_WAIT_TIME');
2525

2626
if (configuredTimeout) {
2727
this.timeoutTime = parseInt(configuredTimeout);
2828
}
2929
}
3030

3131
async onModuleInit() {
32-
if (this.configSerivce.get<string>('NODE_ENV') === 'test') {
32+
if (
33+
this.configService.get<string>('NODE_ENV') === 'development' ||
34+
this.configService.get<string>('NODE_ENV') === 'test'
35+
) {
3336
return;
3437
}
3538

@@ -42,7 +45,10 @@ export class OrchestratorBase implements OnModuleInit {
4245

4346
@Cron('*/1 * * * *')
4447
async checkQueue() {
45-
if (this.configSerivce.get<string>('NODE_ENV') === 'test') {
48+
if (
49+
this.configService.get<string>('NODE_ENV') === 'development' ||
50+
this.configService.get<string>('NODE_ENV') === 'test'
51+
) {
4652
return;
4753
}
4854

libs/backend/orchestrator/src/services/render.service.ts

+24-11
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,33 @@ export class RenderService {
1414
private renderApi!: string;
1515

1616
constructor(private readonly configService: ConfigService<ConfigType>) {
17-
this.headers = {
18-
accept: 'application/json',
19-
authorization: `Bearer ${this.configService.get<string>('RENDER_API_KEY')}`,
20-
};
17+
if (
18+
this.configService.get<string>('NODE_ENV') === 'development' ||
19+
this.configService.get<string>('NODE_ENV') === 'test'
20+
) {
21+
this._logger.verbose(`Skipping startService for ${RenderService.name} in development`);
22+
} else {
23+
this.headers = {
24+
accept: 'application/json',
25+
authorization: `Bearer ${this.configService.get<string>('RENDER_API_KEY')}`,
26+
};
2127

22-
const api = this.configService.get<string>('RENDER_API_URL');
28+
const api = this.configService.get<string>('RENDER_API_URL');
2329

24-
if (!api) {
25-
throw new Error('RENDER_API_URL is not defined');
26-
}
30+
if (!api) {
31+
throw new Error('RENDER_API_URL is not defined');
32+
}
2733

28-
this.renderApi = api;
34+
this.renderApi = api;
35+
}
2936
}
3037

3138
async startService(service: Service) {
3239
// Don't start services in development
33-
if (this.configService.get<string>('NODE_ENV') === 'development') {
40+
if (
41+
this.configService.get<string>('NODE_ENV') === 'development' ||
42+
this.configService.get<string>('NODE_ENV') === 'test'
43+
) {
3444
this._logger.verbose(`Skipping startService for ${service.name} in development`);
3545
return;
3646
}
@@ -64,7 +74,10 @@ export class RenderService {
6474

6575
async suspendService(service: Service) {
6676
// Don't suspend services in development
67-
if (this.configService.get<string>('NODE_ENV') === 'development') {
77+
if (
78+
this.configService.get<string>('NODE_ENV') === 'development' ||
79+
this.configService.get<string>('NODE_ENV') === 'test'
80+
) {
6881
this._logger.verbose(`Skipping suspendService for ${service.name} in development`);
6982
return;
7083
}

libs/utils/src/config/configuration.ts

+25-6
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,24 @@ export const configSchema = Joi.object({
111111
VR_API_USER: Joi.string().optional(),
112112
VR_API_PASS: Joi.string().optional(),
113113

114-
TWIZZIT_API: Joi.string().uri().required(),
115-
TWIZZIT_API_USER: Joi.string().required(),
116-
TWIZZIT_API_PASS: Joi.string().required(),
114+
TWIZZIT_API: Joi.when('NODE_ENV', {
115+
is: Joi.valid('production', 'beta'),
116+
then: Joi.string().required(),
117+
otherwise: Joi.string().optional(),
118+
}),
119+
TWIZZIT_API_USER: Joi.when('NODE_ENV', {
120+
is: Joi.valid('production', 'beta'),
121+
then: Joi.string().required(),
122+
otherwise: Joi.string().optional(),
123+
}),
124+
TWIZZIT_API_PASS: Joi.when('NODE_ENV', {
125+
is: Joi.valid('production', 'beta'),
126+
then: Joi.string().required(),
127+
otherwise: Joi.string().optional(),
128+
}),
117129

118130
CP_PASS: Joi.string().optional(),
119131

120-
121132
APOLLO_GRAPH_REF: Joi.when('NODE_ENV', {
122133
is: Joi.valid('production', 'beta'),
123134
then: Joi.string().required(),
@@ -126,8 +137,16 @@ export const configSchema = Joi.object({
126137

127138
GRAPH_ID: Joi.string().optional(),
128139

129-
RENDER_API_KEY: Joi.string().required(),
130-
RENDER_API_URL: Joi.string().uri().required(),
140+
RENDER_API_KEY: Joi.when('NODE_ENV', {
141+
is: Joi.valid('production', 'beta'),
142+
then: Joi.string().required(),
143+
otherwise: Joi.string().optional(),
144+
}),
145+
RENDER_API_URL: Joi.when('NODE_ENV', {
146+
is: Joi.valid('production', 'beta'),
147+
then: Joi.string().uri().required(),
148+
otherwise: Joi.string().uri().optional(),
149+
}),
131150
RENDER_WAIT_TIME: Joi.number().integer().optional().default(2_100_000),
132151
});
133152

0 commit comments

Comments
 (0)