From d751de2e46934ccbe7a22859365ce7dd6b93487d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Aug 2021 09:45:31 +0000 Subject: [PATCH 1/3] chore(deps): bump path-parse from 1.0.6 to 1.0.7 in /server Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] --- server/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index 9799b7e..5be581b 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -5257,9 +5257,9 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-type": { "version": "3.0.0", From 6c7faa40a9979ba1ff4b653a768a93a92ed56c07 Mon Sep 17 00:00:00 2001 From: Kalane Date: Fri, 24 Sep 2021 22:25:28 +0200 Subject: [PATCH 2/3] feat: add some console.time to check what's taking time sometimes --- server/app/Controllers/Http/SummonersController.ts | 6 ++++++ server/app/Services/MatchService.ts | 3 +++ server/app/Services/StatsService.ts | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/server/app/Controllers/Http/SummonersController.ts b/server/app/Controllers/Http/SummonersController.ts index 5fdb6dc..0bbfc4f 100644 --- a/server/app/Controllers/Http/SummonersController.ts +++ b/server/app/Controllers/Http/SummonersController.ts @@ -42,15 +42,21 @@ export default class SummonersController { finalJSON.seasons = [getCurrentSeason()] // CURRENT GAME + console.time('playing') const currentGame = await Jax.Spectator.summonerID(account.id, region) finalJSON.playing = !!currentGame finalJSON.current = currentGame + console.timeEnd('playing') // RANKED STATS + console.time('ranked') finalJSON.ranked = await SummonerService.getRanked(account.id, region) + console.timeEnd('ranked') // RECENT ACTIVITY + console.time('RecentActivity') finalJSON.recentActivity = await StatsService.getRecentActivity(account.puuid) + console.timeEnd('RecentActivity') } catch (e) { console.log(e) console.timeEnd('BASIC_REQUEST') diff --git a/server/app/Services/MatchService.ts b/server/app/Services/MatchService.ts index 670a12d..4173f78 100644 --- a/server/app/Services/MatchService.ts +++ b/server/app/Services/MatchService.ts @@ -21,6 +21,7 @@ class MatchService { let alreadyIn = false let index = 0 do { + console.log('--> CALL TO RIOT MATCHLIST') const newMatchList = await Jax.Matchlist.puuid(account.puuid, region, index) // Error while fetching Riot API if (!newMatchList) { @@ -49,6 +50,7 @@ class MatchService { const currentMatchList = await summonerDB.related('matchList').query().orderBy('matchId', 'asc') const currentMatchListIds = currentMatchList.map((m) => m.matchId) + console.time('RiotMatchList') const newMatchList = await this._fetchMatchListUntil( account, region, @@ -56,6 +58,7 @@ class MatchService { return currentMatchListIds.some((id) => id === newMatchList[newMatchList.length - 1]) } ) + console.timeEnd('RiotMatchList') const matchListToSave: MatchlistDto = [] for (const matchId of newMatchList.reverse()) { diff --git a/server/app/Services/StatsService.ts b/server/app/Services/StatsService.ts index 36600ac..43b271f 100644 --- a/server/app/Services/StatsService.ts +++ b/server/app/Services/StatsService.ts @@ -5,7 +5,10 @@ import BasicMatchSerializer from 'App/Serializers/BasicMatchSerializer' class StatsService { public async getRecentActivity(puuid: string) { - return MatchRepository.recentActivity(puuid) + console.time('RecentActivity') + const recentActivity = await MatchRepository.recentActivity(puuid) + console.timeEnd('RecentActivity') + return recentActivity } public async getSummonerStats(puuid: string, season?: number) { console.time('GLOBAL') From e2732cbed4aabc69dbd0af06368e182164e579cd Mon Sep 17 00:00:00 2001 From: Kalane Date: Fri, 24 Sep 2021 22:27:59 +0200 Subject: [PATCH 3/3] fix: oopsie --- server/app/Controllers/Http/SummonersController.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/app/Controllers/Http/SummonersController.ts b/server/app/Controllers/Http/SummonersController.ts index 0bbfc4f..3f6bf78 100644 --- a/server/app/Controllers/Http/SummonersController.ts +++ b/server/app/Controllers/Http/SummonersController.ts @@ -54,9 +54,7 @@ export default class SummonersController { console.timeEnd('ranked') // RECENT ACTIVITY - console.time('RecentActivity') finalJSON.recentActivity = await StatsService.getRecentActivity(account.puuid) - console.timeEnd('RecentActivity') } catch (e) { console.log(e) console.timeEnd('BASIC_REQUEST')