togglecraft 1.0.3 → 1.0.4

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: 33360223d2f26e037faa039bc9c8033cda78f7597e90dac2b2998e9a921daab7
4
- data.tar.gz: 8522409a6d3d4b8e6ed49a7db8da1ef8bba17f4c498523b9c9a2c0c48440ef6b
3
+ metadata.gz: 711966e007e332c82cc57e233d0edab3f229047b409f172c1c00e9e55816779f
4
+ data.tar.gz: 2251a206c3592dac11eedbce17c9ff114b3f414e24534b76015f9f24231cfa9b
5
5
  SHA512:
6
- metadata.gz: 92920a17fdadae7951231d95455e1a4925d3c1be1db3beef2286c389208e6ff989126665605e5b7fcf49c7b9056a1a7785aaf62a5be9addd605cae36842734ee
7
- data.tar.gz: 44f8e14db2f45b284396b774291394df7a5d904bd596f6d94c3d5dab0c65d9b6700585416a9f8b1f3cddf18e4389f66fae360f509e7368acd1f2e8164695fc50
6
+ metadata.gz: 7a5fcf7f88151fafc9ba7bc8b04cb60c6b42594ae8dedde3e5937fe6baf86384532a869cf20b2d8004f3d82acf3d89c44028e7b26472e26ead1092c57cf82853
7
+ data.tar.gz: 365f5ad667568bced8e2bc4e67361d2f490b5976409d7886676bde8656aefd61151e49dae527b646882548d32c386b611c1ae6ad7fc7002dd69df267272b53e3
data/CHANGELOG.md CHANGED
@@ -98,6 +98,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
98
98
  ## [Unreleased]
99
99
 
100
100
  ### Planned Features
101
+
102
+ ## [1.0.4] - 2025-10-31
103
+
104
+ ### Fixed
105
+ - **Critical:** Fixed SSE reconnection failure when heartbeat receives 404 response
106
+ - Heartbeat thread would terminate itself before scheduling reconnection
107
+ - Added graceful thread exit when connection is marked as disconnected
108
+ - Reset reconnection attempts for clean retry on 404 response
109
+ - Prevents permanent connection loss when server detects stale connections
110
+
111
+ ## [1.0.3] - 2025-10-31
112
+
113
+ ### Fixed
114
+ - Fixed evaluation cache not clearing on flag updates
115
+ - Cache now properly invalidates when flags are updated via SSE
116
+ - Ensures clients always evaluate with latest flag configuration
117
+
118
+ ## [1.0.2] - 2025-10-30
119
+
120
+ ### Fixed
121
+ - Hardcoded production API URLs to prevent configuration issues
122
+ - Removed `heartbeat_domain` override that could cause misrouting
123
+ - Heartbeat requests now always go to correct production endpoint
124
+
125
+ ## [1.0.1] - 2025-10-26
126
+
127
+ ### Fixed
128
+ - Fixed SSE streaming connection handling
129
+ - Fixed string key handling in flag evaluation
130
+ - Properly handles both symbol and string keys
131
+ - Consistent key normalization across all methods
101
132
  - Redis cache adapter
102
133
  - Custom cache adapter support
103
134
  - Additional targeting operators
@@ -224,6 +224,8 @@ module ToggleCraft
224
224
 
225
225
  @heartbeat_timer = Thread.new do
226
226
  loop do
227
+ break unless @connected # Exit loop if disconnected
228
+
227
229
  sleep @options[:heartbeat_interval]
228
230
 
229
231
  # Add random jitter (0-30 seconds)
@@ -232,6 +234,7 @@ module ToggleCraft
232
234
 
233
235
  send_heartbeat if @connected
234
236
  end
237
+ log 'Heartbeat thread exiting'
235
238
  rescue StandardError => e
236
239
  log "Heartbeat thread error: #{e.message}"
237
240
  end
@@ -281,8 +284,20 @@ module ToggleCraft
281
284
  elsif response.status.code == 404
282
285
  # Connection not found on server - reconnect
283
286
  log 'Connection not found on server, disconnecting and reconnecting'
284
- disconnect
287
+
288
+ # CRITICAL: Don't call disconnect from within heartbeat thread!
289
+ # disconnect calls stop_heartbeat which would kill THIS thread
290
+ # before we can schedule reconnection.
291
+ @connected = false
292
+ @connection_id = nil
293
+ stop_connection
294
+
285
295
  @should_reconnect = true
296
+ @reconnect_attempts = 0 # Reset attempts for clean reconnection
297
+
298
+ # Stop heartbeat thread safely (will exit naturally on next iteration)
299
+ # Don't kill the thread we're running in!
300
+
286
301
  schedule_reconnection
287
302
  else
288
303
  log "Heartbeat failed: #{response.status}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ToggleCraft
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togglecraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ToggleCraft