@@ -40,7 +40,6 @@ public final class RealtimeChannelV2: Sendable {
4040
4141 let logger : ( any SupabaseLogger ) ?
4242 let socket : RealtimeClientV2
43- let maxRetryAttempt = 5
4443
4544 @MainActor var joinRef : String ? { mutableState. joinRef }
4645
@@ -86,7 +85,7 @@ public final class RealtimeChannelV2: Sendable {
8685
8786 /// Subscribes to the channel.
8887 public func subscribeWithError( ) async throws {
89- logger? . debug ( " Starting subscription to channel ' \( topic) ' (attempt 1/ \( maxRetryAttempt ) ) " )
88+ logger? . debug ( " Starting subscription to channel ' \( topic) ' (attempt 1/ \( socket . options . maxRetryAttempts ) ) " )
9089
9190 status = . subscribing
9291
@@ -100,12 +99,12 @@ public final class RealtimeChannelV2: Sendable {
10099
101100 var attempts = 0
102101
103- while attempts < maxRetryAttempt {
102+ while attempts < socket . options . maxRetryAttempts {
104103 attempts += 1
105104
106105 do {
107106 logger? . debug (
108- " Attempting to subscribe to channel ' \( topic) ' (attempt \( attempts) / \( maxRetryAttempt ) ) "
107+ " Attempting to subscribe to channel ' \( topic) ' (attempt \( attempts) / \( socket . options . maxRetryAttempts ) ) "
109108 )
110109
111110 try await withTimeout ( interval: socket. options. timeoutInterval) { [ self ] in
@@ -117,10 +116,10 @@ public final class RealtimeChannelV2: Sendable {
117116
118117 } catch is TimeoutError {
119118 logger? . debug (
120- " Subscribe timed out for channel ' \( topic) ' (attempt \( attempts) / \( maxRetryAttempt ) ) "
119+ " Subscribe timed out for channel ' \( topic) ' (attempt \( attempts) / \( socket . options . maxRetryAttempts ) ) "
121120 )
122121
123- if attempts < maxRetryAttempt {
122+ if attempts < socket . options . maxRetryAttempts {
124123 // Add exponential backoff with jitter
125124 let delay = calculateRetryDelay ( for: attempts)
126125 logger? . debug (
@@ -136,7 +135,7 @@ public final class RealtimeChannelV2: Sendable {
136135 }
137136 } else {
138137 logger? . error (
139- " Failed to subscribe to channel ' \( topic) ' after \( maxRetryAttempt ) attempts due to timeout "
138+ " Failed to subscribe to channel ' \( topic) ' after \( socket . options . maxRetryAttempts ) attempts due to timeout "
140139 )
141140 }
142141 } catch is CancellationError {
0 commit comments