Skip to content

Commit

Permalink
Fix #404
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Apr 10, 2015
1 parent 924ec35 commit 2713bcf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/redmine_git_hosting/cache/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ def set_cache(repo_id, command, output)
# Create a SHA256 of the Git command as key id
hashed_command = hash_key(repo_id, command)

# If *max_cache_time* is set to -1 (until next commit) then
# set the cache time to 1 day (we don't know when will be the next commit)
cache_time = (max_cache_time < 0) ? 86400 : max_cache_time

begin
client.set(hashed_command, output, ex: max_cache_time)
client.set(hashed_command, output, ex: cache_time)
true
rescue => e
logger.error("Redis Adapter : could not insert in cache, this is the error : '#{e.message}'")
Expand Down

0 comments on commit 2713bcf

Please sign in to comment.