faye-redis-ng 1.0.10 → 1.0.12

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: 398f99e890ab9d57e91c5f42f93898488c2b1f475f0831d6079e06314a1d4923
4
+ data.tar.gz: 7191ecc674147302d1ccce44a612ede961d53709059bd21eb69b28cefe527385
5
5
  SHA512:
6
- metadata.gz: 1e55a67832698a6969390882eaf687c7829de4f70907bc33e796103f9336cc403879bf6721f052611c3073f64650822ef7d12e8acc13a3ec1f6b55b9f11b1810
7
- data.tar.gz: 9a46f1bd0136923f320d723cf96cf7e64cd7193f9f4c2e19704bed4b268e180892b1ae54427a5888516816597d9ee77170a82cb6784203eb22ba5c11cd456639
6
+ metadata.gz: 3fe20898a79896711f0e003aaf9e6e44baa6b455130260bd6d24ce03424460c140d51a55da29fba63920490e6e04691318e244a48d608ac0f9c6ceeca443f4d7
7
+ data.tar.gz: f3317d04d6423963b17dd05d6e24b5f37b9a416da06780c92f118a94e4e42b3116e444cdb0fa18e89e4ef173d524325bd1e2cc0c54bf7235e4733162df740262
data/CHANGELOG.md CHANGED
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.12] - 2025-11-01
11
+
12
+ ### Changed - Aligned Subscription TTL with Message TTL
13
+ - **Adjusted subscription_ttl to 1 hour**: Match message_ttl to prevent message loss window
14
+ - **Previous (v1.0.11)**: `subscription_ttl: 300` (5 minutes)
15
+ - **New**: `subscription_ttl: 3600` (1 hour, same as message_ttl)
16
+ - **Rationale**:
17
+ - Subscription and message TTL must be aligned to prevent message loss window
18
+ - If subscription expires before messages, new messages won't be enqueued for disconnected clients
19
+ - Example: If subscription expires at 5 minutes but messages persist for 1 hour, any new messages after 5 minutes won't reach the client even if they reconnect within 1 hour
20
+ - **Impact**:
21
+ - Prevents message loss: disconnected clients get all messages within 1-hour window
22
+ - No TTL gap: subscriptions and messages expire together
23
+ - Conservative approach for reliable message delivery
24
+ - **Trade-offs**:
25
+ - Uses more memory than 5-minute TTL (but still 96% less than original 24 hours)
26
+ - 1-hour reconnection window is sufficient for most mobile/network interruptions
27
+ - Maintains 60x safety buffer (60 GC cycles @ 60s interval) for proper cleanup
28
+ - **Affected keys**:
29
+ - `{namespace}:subscriptions:{client_id}` (SET)
30
+ - `{namespace}:channels:{channel}` (SET)
31
+ - `{namespace}:subscription:{client_id}:{channel}` (Hash)
32
+ - `{namespace}:patterns` (SET)
33
+ - **Backward compatibility**: Users can still override with custom `subscription_ttl` option
34
+
35
+ ### Notes
36
+ - This change ensures subscriptions don't expire before their associated messages
37
+ - The 1-hour TTL provides ample buffer (60 GC cycles) for cleanup
38
+ - TTL-safe implementation (v1.0.10) ensures active subscriptions maintain their original TTL
39
+ - Conservative approach: prioritizes message delivery over aggressive memory optimization
40
+
41
+ ## [1.0.11] - 2025-10-31
42
+
43
+ ### Changed - Reduced Subscription TTL (Reverted in v1.0.12)
44
+ - **Reduced subscription_ttl from 24 hours to 5 minutes**: More aggressive cleanup of orphaned subscription data
45
+ - **Previous**: `subscription_ttl: 86400` (24 hours)
46
+ - **New**: `subscription_ttl: 300` (5 minutes = 5x client_timeout)
47
+ - **Issue discovered**: This created a message loss window - subscriptions expired in 5 minutes but messages persisted for 1 hour
48
+ - **Resolution**: Reverted in v1.0.12 to align with message_ttl (1 hour)
49
+
10
50
  ## [1.0.10] - 2025-10-30
11
51
 
12
52
  ### 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: 3600, # Subscription keys TTL (seconds, default: 1 hour)
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] || 3600 # 1 hour default (matches message_ttl)
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.12'
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: 3600, # Subscription keys TTL (1 hour, matches message_ttl), 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.12
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