Skip to content

Commit 3020fc0

Browse files
authored
Ensure redis polling updates are done in a transaction (#30)
Without this, there is an interval during which flag values are missing.
1 parent deea621 commit 3020fc0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/ldclient-rb/redis_feature_store.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,10 @@ def delete(key, version)
158158
def init(fs)
159159
@cache.clear
160160
with_connection do |redis|
161-
redis.del(@features_key)
162-
fs.each { |k, f| put_redis_and_cache(redis, k, f) }
161+
redis.multi do |multi|
162+
redis.del(@features_key)
163+
fs.each { |k, f| put_redis_and_cache(multi, k, f) }
164+
end
163165
end
164166
put_cache(INIT_KEY, true)
165167
@logger.info("RedisFeatureStore: initialized with #{fs.count} feature flags")

0 commit comments

Comments
 (0)