faye-redis-ng 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 055d9be802f284752c5ae672d4d11c9121ef023739e17508e9957ef5d6880df7
4
- data.tar.gz: 1119068a05ad0d0dbfffdd7d92cb1b882d9f98308f2a868818e341e01ed21139
3
+ metadata.gz: 5a2266042c42929dc9203cf1160bbfd64d429c87cdb076b3369cd55bbf77032e
4
+ data.tar.gz: 51509e6fb5fb775bfbdcd4db0dada3dfa26f6bee5f5729d2b3fa165b5b417644
5
5
  SHA512:
6
- metadata.gz: 1e55a67832698a6969390882eaf687c7829de4f70907bc33e796103f9336cc403879bf6721f052611c3073f64650822ef7d12e8acc13a3ec1f6b55b9f11b1810
7
- data.tar.gz: 9a46f1bd0136923f320d723cf96cf7e64cd7193f9f4c2e19704bed4b268e180892b1ae54427a5888516816597d9ee77170a82cb6784203eb22ba5c11cd456639
6
+ metadata.gz: 79c6d4bee6b55572a772a4977fd5b5a5857746c415bac1f6f0a802ad69b16e137642b90d20ec02ec21abb95f69e5fab9ab830f018c6aaa974ad56b2c3202f269
7
+ data.tar.gz: 38c29ca6cd4330c5a862951b2810e8e095e4dec2939691bd8379ef714f947ad05a0e875bcf55a53de42d35913357d2f05c38f08b0ce16da12e553e2c7a22f1b1
data/CHANGELOG.md CHANGED
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.11] - 2025-10-31
11
+
12
+ ### Changed - Optimized Subscription TTL
13
+ - **Reduced subscription_ttl from 24 hours to 5 minutes**: More aggressive cleanup of orphaned subscription data
14
+ - **Previous**: `subscription_ttl: 86400` (24 hours)
15
+ - **New**: `subscription_ttl: 300` (5 minutes = 5x client_timeout)
16
+ - **Rationale**: Client keys expire after 60 seconds, keeping subscription data for 24 hours was excessive
17
+ - **Impact**: Faster memory reclamation for disconnected clients while maintaining safety net
18
+ - **Benefits**:
19
+ - Reduces memory footprint by cleaning up orphaned subscriptions faster
20
+ - Maintains 5-minute safety window (5 GC cycles) for proper cleanup
21
+ - Allows short-lived reconnections within 5 minutes to reuse subscription data
22
+ - **Affected keys**:
23
+ - `{namespace}:subscriptions:{client_id}` (SET)
24
+ - `{namespace}:channels:{channel}` (SET)
25
+ - `{namespace}:subscription:{client_id}:{channel}` (Hash)
26
+ - `{namespace}:patterns` (SET)
27
+ - **Backward compatibility**: Users can still override with custom `subscription_ttl` option
28
+
29
+ ### Notes
30
+ - This change is safe because automatic GC runs every 60 seconds by default
31
+ - The 5-minute TTL provides sufficient buffer (5 GC cycles) for cleanup
32
+ - TTL-safe implementation (v1.0.10) ensures active subscriptions maintain their original TTL
33
+
10
34
  ## [1.0.10] - 2025-10-30
11
35
 
12
36
  ### Fixed - Critical Memory Leak (P0 - Critical Priority)
data/README.md CHANGED
@@ -80,6 +80,7 @@ bayeux = Faye::RackAdapter.new(app, {
80
80
  # Data expiration
81
81
  client_timeout: 60, # Client session timeout (seconds)
82
82
  message_ttl: 3600, # Message TTL (seconds)
83
+ subscription_ttl: 300, # Subscription keys TTL (seconds, default: 5 minutes)
83
84
 
84
85
  # Garbage collection
85
86
  gc_interval: 60, # Automatic GC interval (seconds), set to 0 or false to disable
@@ -12,7 +12,7 @@ module Faye
12
12
  # Subscribe a client to a channel
13
13
  def subscribe(client_id, channel, &callback)
14
14
  timestamp = Time.now.to_i
15
- subscription_ttl = @options[:subscription_ttl] || 86400 # 24 hours default
15
+ subscription_ttl = @options[:subscription_ttl] || 300 # 5 minutes default (5x client_timeout)
16
16
 
17
17
  client_subs_key = client_subscriptions_key(client_id)
18
18
  channel_subs_key = channel_subscribers_key(channel)
@@ -1,5 +1,5 @@
1
1
  module Faye
2
2
  class Redis
3
- VERSION = '1.0.10'
3
+ VERSION = '1.0.11'
4
4
  end
5
5
  end
data/lib/faye/redis.rb CHANGED
@@ -25,7 +25,7 @@ module Faye
25
25
  retry_delay: 1,
26
26
  client_timeout: 60,
27
27
  message_ttl: 3600,
28
- subscription_ttl: 86400, # Subscription keys TTL (24 hours), provides safety net if GC fails
28
+ subscription_ttl: 300, # Subscription keys TTL (5 minutes = 5x client_timeout), provides safety net if GC fails
29
29
  namespace: 'faye',
30
30
  gc_interval: 60, # Automatic garbage collection interval (seconds), set to 0 or false to disable
31
31
  cleanup_batch_size: 50 # Number of items per batch during cleanup (min: 1, max: 1000, prevents blocking)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faye-redis-ng
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-30 00:00:00.000000000 Z
11
+ date: 2025-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis