Skip to content

Commit

Permalink
Merge pull request #694 from ViktorTigerstrom/2023-11-restart-lndclie…
Browse files Browse the repository at this point in the history
…nt-on-failure

multi: restart LND Client on setup failure
  • Loading branch information
ellemouton authored Jan 5, 2024
2 parents c757746 + fcd22a7 commit ee69bbd
Show file tree
Hide file tree
Showing 16 changed files with 319 additions and 103 deletions.
4 changes: 4 additions & 0 deletions app/src/types/generated/lit-status_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion app/src/types/generated/lit-status_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions app/src/util/tests/sampleData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ export const litSubServerStatus: STATUS.SubServerStatusResp.AsObject = {
disabled: false,
running: true,
error: '',
customStatus: '',
},
],
[
Expand All @@ -1079,6 +1080,7 @@ export const litSubServerStatus: STATUS.SubServerStatusResp.AsObject = {
disabled: false,
running: true,
error: '',
customStatus: '',
},
],
[
Expand All @@ -1087,6 +1089,7 @@ export const litSubServerStatus: STATUS.SubServerStatusResp.AsObject = {
disabled: false,
running: true,
error: '',
customStatus: '',
},
],
[
Expand All @@ -1095,6 +1098,7 @@ export const litSubServerStatus: STATUS.SubServerStatusResp.AsObject = {
disabled: false,
running: true,
error: '',
customStatus: '',
},
],
[
Expand All @@ -1103,6 +1107,7 @@ export const litSubServerStatus: STATUS.SubServerStatusResp.AsObject = {
disabled: false,
running: true,
error: '',
customStatus: '',
},
],
[
Expand All @@ -1111,6 +1116,7 @@ export const litSubServerStatus: STATUS.SubServerStatusResp.AsObject = {
disabled: false,
running: true,
error: '',
customStatus: '',
},
],
],
Expand Down
2 changes: 1 addition & 1 deletion autopilotserverrpc/autopilotserver.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion litrpc/firewall.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion litrpc/lit-accounts.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion litrpc/lit-autopilot.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion litrpc/lit-sessions.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 31 additions & 18 deletions litrpc/lit-status.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions litrpc/lit-status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ message SubServerStatus {
// error describes an error that might have resulted in the sub-server not
// starting up properly.
string error = 3;

// custom_status details a custom state that the sub-server has entered,
// which is unique to the sub-server, and which is not the standard
// disabled, running or errored state.
string custom_status = 4;
}
4 changes: 4 additions & 0 deletions litrpc/lit-status.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
"error": {
"type": "string",
"description": "error describes an error that might have resulted in the sub-server not\nstarting up properly."
},
"custom_status": {
"type": "string",
"description": "custom_status details a custom state that the sub-server has entered,\nwhich is unique to the sub-server, and which is not the standard\ndisabled, running or errored state."
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion litrpc/proxy.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions proto/lit-status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ message SubServerStatus {
// error describes an error that might have resulted in the sub-server not
// starting up properly.
string error = 3;

// custom_status details a custom state that the sub-server has entered,
// which is unique to the sub-server, and which is not the standard
// disabled, running or errored state.
string custom_status = 4;
}
9 changes: 4 additions & 5 deletions rpc_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,18 +638,17 @@ func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {

// Check with the status manger to see if the sub-server is ready to
// handle the request.
serverStatus, err := p.statusMgr.GetStatus(system)
ready, disabled, err := p.statusMgr.IsSystemReady(system, requestURI)
if err != nil {
return err
}

if serverStatus.Disabled {
if disabled {
return fmt.Errorf("%s has been disabled", system)
}

if !serverStatus.Running {
return fmt.Errorf("%s is not running: %s", system,
serverStatus.Err)
if !ready {
return fmt.Errorf("%s is not ready for: %s", system, requestURI)
}

return nil
Expand Down
Loading

0 comments on commit ee69bbd

Please sign in to comment.