Skip to content

Commit b107d60

Browse files
committed
Merge branch 'master' of ssh://github.com/rogchap/wombat
2 parents bcde752 + 73941a3 commit b107d60

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.github/workflows/package.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,3 @@ jobs:
174174
asset_path: Wombat_${{ steps.version.outputs.tag }}_Windows_x86_64.zip/Wombat_${{ steps.version.outputs.tag }}_Windows_x86_64.zip
175175
asset_name: Wombat_${{ steps.version.outputs.tag }}_Windows_x86_64.zip
176176
asset_content_type: application/octet-stream
177-

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Added
1212
- Support export/import request to/from grpcurl command. Thanks to [@devkanro](https://github.com/devkanro) & [@iou90](https://github.com/iou90)
13+
- Immediately retry a disconnected grpc connection before attempting to send a request. Thanks to [@aschey](https://github.com/aschey)
1314

1415
### Fixed
1516
- Update dependencies to fix an issue with newer versions of webkit2gtk. Thanks to [@aschey](https://github.com/aschey)

internal/app/api.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,19 @@ func fieldViewsFromDesc(fds protoreflect.FieldDescriptors, isOneof bool, cd *cyc
709709
return fields, nil
710710
}
711711

712+
func (a *api) RetryConnection() {
713+
state := a.client.conn.GetState()
714+
if state == connectivity.TransientFailure || state == connectivity.Shutdown {
715+
// State is currently disconnected. Do a quick retry in case the server restarted recently.
716+
a.client.conn.ResetConnectBackoff()
717+
stateChanged := make(chan bool)
718+
waitForStateChange := func(data ...interface{}) { stateChanged <- true }
719+
a.runtime.Events.Once(eventClientStateChanged, waitForStateChange)
720+
// Wait for at least one retry to complete before continuing
721+
<-stateChanged
722+
}
723+
}
724+
712725
func (a *api) Send(method string, rawJSON []byte, rawHeaders interface{}) (rerr error) {
713726
defer func() {
714727
if rerr != nil {
@@ -718,6 +731,8 @@ func (a *api) Send(method string, rawJSON []byte, rawHeaders interface{}) (rerr
718731
}
719732
}()
720733

734+
a.RetryConnection()
735+
721736
md, err := a.getMethodDesc(method)
722737
if err != nil {
723738
return err
@@ -1033,8 +1048,8 @@ func (a *api) ImportCommand(kind string, command string) (rerr error) {
10331048
return err
10341049
}
10351050

1036-
return a.emitServicesSelect("/" + args.Method, args.Data, args.Metadata)
1051+
return a.emitServicesSelect("/"+args.Method, args.Data, args.Metadata)
10371052
}
10381053

10391054
return nil
1040-
}
1055+
}

0 commit comments

Comments
 (0)