Skip to content

Commit c1e3220

Browse files
authored
FIX: redis.setex() expects seconds parameter not DateTime (#36238)
## 🔍 Overview This update fixes a bug in chat's `set_replies_count_redis_cache` method. `Discourse.redis.setex()` expects the 2nd parameter to be a seconds value not a `DateTime` value as an integer. This was causing thread cache keys to last for numerous years instead of 5 mintues in Redis. The value should be 300 seconds (5 minutes) instead of `5.minutes.from_now` date/time getting converted to an integer.
1 parent 27854ac commit c1e3220

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/chat/app/models/concerns/chat/thread_cache.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def set_replies_count_cache(value, update_db: false)
5959
def set_replies_count_redis_cache(value)
6060
Discourse.redis.setex(
6161
Chat::Thread.replies_count_cache_redis_key(self.id),
62-
5.minutes.from_now.to_i,
62+
5.minutes.to_i,
6363
value,
6464
)
6565
end

0 commit comments

Comments
 (0)