Skip to content

Commit e4c7275

Browse files
multi: use request overrides in RPC proxy
1 parent 0c6a84b commit e4c7275

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

rpc_proxy.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,18 +638,17 @@ func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {
638638

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

646-
if serverStatus.Disabled {
646+
if disabled {
647647
return fmt.Errorf("%s has been disabled", system)
648648
}
649649

650-
if !serverStatus.Running {
651-
return fmt.Errorf("%s is not running: %s", system,
652-
serverStatus.Err)
650+
if !ready {
651+
return fmt.Errorf("%s is not ready for: %s", system, requestURI)
653652
}
654653

655654
return nil

status/manager.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,6 @@ func (s *Manager) SetCustomStatus(name, customStatus string) {
181181
ss.customStatus = customStatus
182182
}
183183

184-
// GetStatus returns the current status of a given sub-server. This will
185-
// silently fail if the referenced sub-server has not yet been registered.
186-
func (s *Manager) GetStatus(name string) (*SubServerStatus, error) {
187-
s.mu.RLock()
188-
defer s.mu.RUnlock()
189-
190-
status, ok := s.subServers[name]
191-
if !ok {
192-
return nil, errors.New("a sub-server with name %s has not " +
193-
"yet been registered")
194-
}
195-
196-
return status, nil
197-
}
198-
199184
// SetEnabled marks the sub-server with the given name as enabled.
200185
//
201186
// NOTE: This will silently fail if the referenced sub-server has not yet been

0 commit comments

Comments
 (0)