@@ -16,7 +16,7 @@ def clean_channels
1616 return unless config . subscription_expiration_seconds
1717 return unless config . use_redis_object_on_cleanup
1818
19- redis . scan_each ( match : "#{ adapter ::CHANNEL_PREFIX } *" ) do |key |
19+ redis . scan_each ( match : "#{ redis_key ( adapter ::CHANNEL_PREFIX ) } *" ) do |key |
2020 idle = redis . object ( "IDLETIME" , key )
2121 next if idle &.<= config . subscription_expiration_seconds
2222
@@ -28,7 +28,7 @@ def clean_subscriptions
2828 return unless config . subscription_expiration_seconds
2929 return unless config . use_redis_object_on_cleanup
3030
31- redis . scan_each ( match : "#{ adapter ::SUBSCRIPTION_PREFIX } *" ) do |key |
31+ redis . scan_each ( match : "#{ redis_key ( adapter ::SUBSCRIPTION_PREFIX ) } *" ) do |key |
3232 idle = redis . object ( "IDLETIME" , key )
3333 next if idle &.<= config . subscription_expiration_seconds
3434
@@ -37,20 +37,20 @@ def clean_subscriptions
3737 end
3838
3939 def clean_fingerprint_subscriptions
40- redis . scan_each ( match : "#{ adapter ::SUBSCRIPTIONS_PREFIX } *" ) do |key |
40+ redis . scan_each ( match : "#{ redis_key ( adapter ::SUBSCRIPTIONS_PREFIX ) } *" ) do |key |
4141 redis . smembers ( key ) . each do |subscription_id |
42- next if redis . exists? ( adapter ::SUBSCRIPTION_PREFIX + subscription_id )
42+ next if redis . exists? ( redis_key ( adapter ::SUBSCRIPTION_PREFIX ) + subscription_id )
4343
4444 redis . srem ( key , subscription_id )
4545 end
4646 end
4747 end
4848
4949 def clean_topic_fingerprints
50- redis . scan_each ( match : "#{ adapter ::FINGERPRINTS_PREFIX } *" ) do |key |
50+ redis . scan_each ( match : "#{ redis_key ( adapter ::FINGERPRINTS_PREFIX ) } *" ) do |key |
5151 redis . zremrangebyscore ( key , '-inf' , '0' )
5252 redis . zrange ( key , 0 , -1 ) . each do |fingerprint |
53- next if redis . exists? ( adapter ::SUBSCRIPTIONS_PREFIX + fingerprint )
53+ next if redis . exists? ( redis_key ( adapter ::SUBSCRIPTIONS_PREFIX ) + fingerprint )
5454
5555 redis . zrem ( key , fingerprint )
5656 end
@@ -70,6 +70,10 @@ def redis
7070 def config
7171 GraphQL ::AnyCable . config
7272 end
73+
74+ def redis_key ( prefix )
75+ "#{ config . redis_prefix } -#{ prefix } "
76+ end
7377 end
7478 end
7579end
0 commit comments