faye-redis-ng 1.0.11 → 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 +4 -4
 - data/CHANGELOG.md +30 -14
 - data/README.md +1 -1
 - data/lib/faye/redis/subscription_manager.rb +1 -1
 - data/lib/faye/redis/version.rb +1 -1
 - data/lib/faye/redis.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 398f99e890ab9d57e91c5f42f93898488c2b1f475f0831d6079e06314a1d4923
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7191ecc674147302d1ccce44a612ede961d53709059bd21eb69b28cefe527385
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3fe20898a79896711f0e003aaf9e6e44baa6b455130260bd6d24ce03424460c140d51a55da29fba63920490e6e04691318e244a48d608ac0f9c6ceeca443f4d7
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f3317d04d6423963b17dd05d6e24b5f37b9a416da06780c92f118a94e4e42b3116e444cdb0fa18e89e4ef173d524325bd1e2cc0c54bf7235e4733162df740262
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -7,18 +7,24 @@ 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 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            ### Changed -  
     | 
| 
       13 
     | 
    
         
            -
            - ** 
     | 
| 
       14 
     | 
    
         
            -
              - **Previous**: `subscription_ttl:  
     | 
| 
       15 
     | 
    
         
            -
              - **New**: `subscription_ttl:  
     | 
| 
       16 
     | 
    
         
            -
              - **Rationale**: 
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                -  
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                -  
     | 
| 
      
 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
         
     | 
| 
       22 
28 
     | 
    
         
             
              - **Affected keys**:
         
     | 
| 
       23 
29 
     | 
    
         
             
                - `{namespace}:subscriptions:{client_id}` (SET)
         
     | 
| 
       24 
30 
     | 
    
         
             
                - `{namespace}:channels:{channel}` (SET)
         
     | 
| 
         @@ -27,9 +33,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 
     | 
|
| 
       27 
33 
     | 
    
         
             
              - **Backward compatibility**: Users can still override with custom `subscription_ttl` option
         
     | 
| 
       28 
34 
     | 
    
         | 
| 
       29 
35 
     | 
    
         
             
            ### Notes
         
     | 
| 
       30 
     | 
    
         
            -
            - This change  
     | 
| 
       31 
     | 
    
         
            -
            - The  
     | 
| 
      
 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
         
     | 
| 
       32 
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)
         
     | 
| 
       33 
49 
     | 
    
         | 
| 
       34 
50 
     | 
    
         
             
            ## [1.0.10] - 2025-10-30
         
     | 
| 
       35 
51 
     | 
    
         | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -80,7 +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:  
     | 
| 
      
 83 
     | 
    
         
            +
              subscription_ttl: 3600,     # Subscription keys TTL (seconds, default: 1 hour)
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
85 
     | 
    
         
             
              # Garbage collection
         
     | 
| 
       86 
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] ||  
     | 
| 
      
 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)
         
     | 
    
        data/lib/faye/redis/version.rb
    CHANGED
    
    
    
        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:  
     | 
| 
      
 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)
         
     |