[client] change notifyDisconnected call on receiveJobRequest error#5138
Conversation
On handleJobStream, when handling error codes in the switch-case, notifying disconnected in cases where it isn't a disconnection breaks connection status reporting on mobile peers. This commit changes it so it isn't called on Canceled or Unimplemented status codes.
📝 WalkthroughWalkthroughThe GrpcClient's Job streaming error handler has been refactored to selectively invoke disconnection notifications. Rather than unconditionally notifying disconnection for all errors, the change restricts the notification to specific error scenarios: PermissionDenied, other gRPC errors, and non-gRPC errors, narrowing the conditions triggering disconnection signals. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| return backoff.Permanent(err) // unrecoverable error, propagate to the upper layer | ||
| case codes.Canceled: | ||
| log.Debugf("management connection context has been canceled, this usually indicates shutdown") | ||
| return err |
There was a problem hiding this comment.
Shouldn’t we add c.notifyDisconnected(err) here too?



On handleJobStream, when handling error codes from receiveJobRequest in the switch-case, calling notifyDisconnected() in cases where it isn't a disconnection breaks connection status reporting on mobile peers.
This PR changes it so it isn't called on Canceled or Unimplemented status codes.
Describe your changes
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.