Skip to content

Commit 2713bcf

Browse files
author
root
committed
Fix #404
1 parent 924ec35 commit 2713bcf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: lib/redmine_git_hosting/cache/redis.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ def set_cache(repo_id, command, output)
1010
# Create a SHA256 of the Git command as key id
1111
hashed_command = hash_key(repo_id, command)
1212

13+
# If *max_cache_time* is set to -1 (until next commit) then
14+
# set the cache time to 1 day (we don't know when will be the next commit)
15+
cache_time = (max_cache_time < 0) ? 86400 : max_cache_time
16+
1317
begin
14-
client.set(hashed_command, output, ex: max_cache_time)
18+
client.set(hashed_command, output, ex: cache_time)
1519
true
1620
rescue => e
1721
logger.error("Redis Adapter : could not insert in cache, this is the error : '#{e.message}'")

0 commit comments

Comments
 (0)