Skip to content

Commit

Permalink
fix: Small timeout in case of notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Fllorent0D committed Mar 17, 2024
1 parent 872eeec commit a6d8833
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/common/data-aftt/model/member-numeric-ranking.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export class DataAFTTMemberNumericRankingModel {
}


getLatestPoints(licence: number, gender: Gender): Promise<NumericPoints[]> {
const points = this.prismaService.numericPoints.findMany({
async getLatestPoints(licence: number, gender: Gender): Promise<NumericPoints[]> {
const points = await this.prismaService.numericPoints.findMany({
where: {
memberLicence: licence,
member: {
Expand Down Expand Up @@ -48,6 +48,9 @@ export class DataAFTTMemberNumericRankingModel {

if(latestPoint?.points !== points.points || latestPoint?.ranking !== points.ranking){
// push a notification to player
// wait 2 sec
await new Promise(resolve => setTimeout(resolve, 2000));

await this.bepingNotifierService.notifyNumericRankingChanged(points.memberLicence, latestPoint?.points, points.points)

return this.prismaService.numericPoints.create({
Expand Down

0 comments on commit a6d8833

Please sign in to comment.