Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 94965a9

Browse files
Merge pull request #1268 from melbit-deanfogarty/master
Repair caching.
2 parents 6f2dbf3 + 39e8f55 commit 94965a9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/scripts/jira-issues.coffee

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ module.exports = (robot) ->
5353
now = new Date().getTime()
5454
if cache.length > 0
5555
cache.shift() until cache.length is 0 or cache[0].expires >= now
56+
57+
msg.send item.message for item in cache when item.issue is issue
58+
5659
if cache.length == 0 or (item for item in cache when item.issue is issue).length == 0
57-
cache.push({issue: issue, expires: now + 120000})
5860
robot.http(jiraUrl + "/rest/api/2/issue/" + issue)
5961
.auth(auth)
6062
.get() (err, res, body) ->
@@ -74,11 +76,12 @@ module.exports = (robot) ->
7476
else
7577
message += ', fixVersion: NONE'
7678

77-
msg.send message
78-
7979
urlRegex = new RegExp(jiraUrl + "[^\\s]*" + key)
8080
if not msg.message.text.match(urlRegex)
81-
msg.send jiraUrl + "/browse/" + key
81+
message += "\n" + jiraUrl + "/browse/" + key
82+
83+
msg.send message
84+
cache.push({issue: issue, expires: now + 120000, message: message})
8285
catch error
8386
try
8487
msg.send "[*ERROR*] " + json.errorMessages[0]

0 commit comments

Comments
 (0)