Skip to content

Commit

Permalink
update clanview and remove cache for single views
Browse files Browse the repository at this point in the history
  • Loading branch information
fcaps committed Dec 3, 2023
1 parent dfab492 commit 28e374e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
19 changes: 1 addition & 18 deletions src/backend/services/ClanService.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,7 @@ class ClanService {
}

async getClan (id, ignoreCache = false) {
const cacheKey = this.getCacheKey('clan-' + id)

if (this.cacheService.has(cacheKey) && ignoreCache === false) {
return this.cacheService.get(cacheKey)
}

if (this.mutexService.locked) {
await this.mutexService.acquire(() => {
}, this.lockTimeout)
return this.getClan(id)
}

await this.mutexService.acquire(async () => {
const result = await this.dataRepository.fetchClan(id)
this.cacheService.set(cacheKey, result, clanTTL)
})

return this.getClan(id)
return await this.dataRepository.fetchClan(id)
}

async getAll () {
Expand Down
8 changes: 2 additions & 6 deletions src/backend/templates/views/clans/clan.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ block content
table#clan-info
tr
td NAME
td #{clan.name}
tr
td TAG
td #{clan.tag}
td [#{clan.tag}] #{clan.name}
tr
td LEADER
if clan.leader
Expand All @@ -32,8 +29,7 @@ block content
else
td Free For All
.column8
h2 Description
div #{clan.description}
div(style='white-space:pre-wrap') #{clan.description}
.column12
table#clan-members
thead
Expand Down

0 comments on commit 28e374e

Please sign in to comment.