Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b014494819 |
@@ -1056,6 +1056,13 @@ class ConnectionHandler: ChannelInboundHandler {
|
|||||||
|
|
||||||
func write(operation: ClientOp) async throws {
|
func write(operation: ClientOp) async throws {
|
||||||
guard let buffer = self.batchBuffer else {
|
guard let buffer = self.batchBuffer else {
|
||||||
|
// If state is connected but batchBuffer is nil, this is a "fake connection" state
|
||||||
|
// Trigger reconnect to recover
|
||||||
|
let currentState = state.withLockedValue { $0 }
|
||||||
|
if currentState == .connected {
|
||||||
|
logger.error("Write failed: batchBuffer is nil but state is connected, triggering reconnect")
|
||||||
|
handleDisconnect()
|
||||||
|
}
|
||||||
throw NatsError.ClientError.invalidConnection("not connected")
|
throw NatsError.ClientError.invalidConnection("not connected")
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
|||||||
Reference in New Issue
Block a user