Refresh GitHub<->Slack user mapping every 24 hours

This commit is contained in:
Pedro Pombeiro 2018-03-27 21:24:51 +02:00
parent 44662eeed2
commit ffca465ccc
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647

View File

@ -20,6 +20,9 @@ class GitHubSlackIdMapper {
this.robot = robot this.robot = robot
this.cache = new MemCache({ timeoutDisabled: true }) this.cache = new MemCache({ timeoutDisabled: true })
this.buildPromise = new Promise((resolve, reject) => internalBuild(this.robot, this.cache).then(resolve).catch(reject)) this.buildPromise = new Promise((resolve, reject) => internalBuild(this.robot, this.cache).then(resolve).catch(reject))
// Refresh cache every day
setTimeout(() => internalBuild(this.robot, this.cache), 24 * 60 * 60 * 1000)
} }
async getGitHubIdFromSlackId (slackUserId, cache) { async getGitHubIdFromSlackId (slackUserId, cache) {