Skip to content

Commit

Permalink
Move to more efficent cache
Browse files Browse the repository at this point in the history
  • Loading branch information
hardillb committed Nov 11, 2024
1 parent cc6fce4 commit 7afa350
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions forge/ee/lib/teamBroker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,26 @@ module.exports.init = function (app) {
})

async function addUsedTopic (topic, team) {
topicsList[`ff/v1/${team}/c/${topic}`] = {
ttl: Date.now() + (TOPIC_TTL)
const teamList = topicsList[team]
if (!teamList) {
topicsList[team] = {
[topic]: { ttl: Date.now() + (TOPIC_TTL) }
}
} else {
teamList[topic] = { ttl: Date.now() + (TOPIC_TTL) }
}
// topicsList[`ff/v1/${team}/c/${topic}`] = {
// ttl: Date.now() + (TOPIC_TTL)
// }
}

async function getUsedTopics (teamId) {
const prefixLength = `ff/v1/${teamId}/c/`.length
const topics = Object.keys(topicsList)
.filter(t => t.startsWith(`ff/v1/${teamId}/c/`))
.map(t => t.substring(prefixLength))
// const prefixLength = `ff/v1/${teamId}/c/`.length
// const topics = Object.keys(topicsList)
// .filter(t => t.startsWith(`ff/v1/${teamId}/c/`))
// .map(t => t.substring(prefixLength))
console.log(topicsList)

Check failure on line 78 in forge/ee/lib/teamBroker/index.js

View workflow job for this annotation

GitHub Actions / Postgres tests (18.x)

Unexpected console statement
const topics = topicsList[teamId] ? Object.keys(topicsList[teamId]) : []
return topics
}

Expand Down

0 comments on commit 7afa350

Please sign in to comment.