togglecraft 1.0.2 → 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 +4 -4
- data/CHANGELOG.md +31 -0
- data/lib/togglecraft/client.rb +3 -0
- data/lib/togglecraft/sse_connection.rb +16 -1
- data/lib/togglecraft/version.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: 711966e007e332c82cc57e233d0edab3f229047b409f172c1c00e9e55816779f
|
|
4
|
+
data.tar.gz: 2251a206c3592dac11eedbce17c9ff114b3f414e24534b76015f9f24231cfa9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/lib/togglecraft/client.rb
CHANGED
|
@@ -429,6 +429,9 @@ module ToggleCraft
|
|
|
429
429
|
# Update cache
|
|
430
430
|
@cache&.set_all_flags(payload[:flags] || {})
|
|
431
431
|
|
|
432
|
+
# Clear evaluation cache for all updated flags
|
|
433
|
+
clear_evaluation_cache_for_flags(payload[:flags]&.keys || [])
|
|
434
|
+
|
|
432
435
|
# Initialize rollout stage tracking
|
|
433
436
|
initialize_rollout_stage_tracking
|
|
434
437
|
|
|
@@ -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
|
-
|
|
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}"
|
data/lib/togglecraft/version.rb
CHANGED