@@ -22,7 +22,7 @@ const FORK_DEPTH_SAFETY_MARGIN: u64 = 31; // Max fork depth for processed commit
2222
2323// SDK metadata constants
2424const SDK_NAME : & str = "laserstream-javascript" ;
25- const SDK_VERSION : & str = "0.2.4 " ;
25+ const SDK_VERSION : & str = "0.2.6 " ;
2626
2727/// Custom interceptor that adds SDK metadata headers to all gRPC requests
2828#[ derive( Clone ) ]
@@ -156,23 +156,22 @@ impl StreamInner {
156156 reconnect_attempts = 1 ; // Reset to 1 since this is the first attempt after progress
157157 }
158158
159- // Report every error as it happens
160- let error_msg = format!( "Connection error (attempt {}): {}" , reconnect_attempts, e) ;
161- let _ = ts_callback. call( Err ( napi:: Error :: from_reason( error_msg) ) , ThreadsafeFunctionCallMode :: Blocking ) ;
159+ // Log error internally but don't yield to consumer until max attempts exhausted
160+ eprintln!( "RECONNECT: Connection failed (attempt {}/{}): {}" , reconnect_attempts, effective_max_attempts, e) ;
162161
163162 // Check if exceeded max reconnect attempts
163+ if reconnect_attempts >= effective_max_attempts {
164+ // Only report error to consumer after exhausting all retries
165+ let error_msg = format!( "Connection failed after {} attempts: {}" , effective_max_attempts, e) ;
166+ let _ = ts_callback. call( Err ( napi:: Error :: from_reason( error_msg) ) , ThreadsafeFunctionCallMode :: Blocking ) ;
167+ break ;
168+ }
164169 }
165170 }
166171
167- if reconnect_attempts >= effective_max_attempts {
168- // Exceeded max reconnect attempts - call error callback one final time
169- let error_msg = format!( "Connection failed after {} attempts" , effective_max_attempts) ;
170- let _ = ts_callback. call( Err ( napi:: Error :: from_reason( error_msg) ) , ThreadsafeFunctionCallMode :: Blocking ) ;
171- break ;
172- }
173-
174172 // Determine where to resume based on commitment level.
175173 let last_tracked_slot = tracked_slot. load( Ordering :: SeqCst ) ;
174+ eprintln!( "RECONNECT: tracked_slot={}" , last_tracked_slot) ;
176175
177176 // Only use from_slot when replay is enabled
178177 if last_tracked_slot > 0 && replay {
0 commit comments