Reverting changes to do thrift call to check if thrift endpoint is valid.
This commit is contained in:
parent
d323c20896
commit
b658803ccb
1 changed files with 2 additions and 25 deletions
27
realis.go
27
realis.go
|
@ -280,35 +280,12 @@ func NewRealisClient(options ...ClientOption) (Realis, error) {
|
||||||
AddBasicAuth(config, config.username, config.password)
|
AddBasicAuth(config, config.username, config.password)
|
||||||
}
|
}
|
||||||
|
|
||||||
client := &realisClient{
|
return &realisClient{
|
||||||
config: config,
|
config: config,
|
||||||
client: aurora.NewAuroraSchedulerManagerClientFactory(config.transport, config.protoFactory),
|
client: aurora.NewAuroraSchedulerManagerClientFactory(config.transport, config.protoFactory),
|
||||||
readonlyClient: aurora.NewReadOnlySchedulerClientFactory(config.transport, config.protoFactory),
|
readonlyClient: aurora.NewReadOnlySchedulerClientFactory(config.transport, config.protoFactory),
|
||||||
adminClient: aurora.NewAuroraAdminClientFactory(config.transport, config.protoFactory),
|
adminClient: aurora.NewAuroraAdminClientFactory(config.transport, config.protoFactory),
|
||||||
logger: config.logger}
|
logger: config.logger}, nil
|
||||||
|
|
||||||
// Verify that the connection is set up correctly and that the endpoint exists
|
|
||||||
// by making a low cost thrift call using the newly created client. If there is an error, return an empty client.
|
|
||||||
taskQ := &aurora.TaskQuery{
|
|
||||||
Role: "test",
|
|
||||||
Environment: "test",
|
|
||||||
JobName: "test",
|
|
||||||
}
|
|
||||||
|
|
||||||
retryErr := ExponentialBackoff(*config.backoff, func() (bool, error) {
|
|
||||||
resp, err := client.readonlyClient.GetTasksWithoutConfigs(taskQ)
|
|
||||||
if resp == nil || err != nil {
|
|
||||||
return false, NewTemporaryError(err)
|
|
||||||
}
|
|
||||||
return true, nil
|
|
||||||
})
|
|
||||||
|
|
||||||
// Unable to successfully make a call even after retrying, return an error
|
|
||||||
if retryErr != nil {
|
|
||||||
return nil, errors.Errorf("Unable to reach scheduler at %v", url)
|
|
||||||
}
|
|
||||||
|
|
||||||
return client, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultClusterFromZKUrl(zkurl string) *Cluster {
|
func GetDefaultClusterFromZKUrl(zkurl string) *Cluster {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue