POC on how verification function would work. Update function should have something similar.
This commit is contained in:
parent
9999a0834d
commit
34a41e86a8
2 changed files with 22 additions and 3 deletions
18
realis.go
18
realis.go
|
@ -672,7 +672,23 @@ func (r *realisClient) CreateJob(auroraJob Job) (*aurora.Response, error) {
|
||||||
func() (*aurora.Response, error) {
|
func() (*aurora.Response, error) {
|
||||||
return r.client.CreateJob(context.TODO(), auroraJob.JobConfig())
|
return r.client.CreateJob(context.TODO(), auroraJob.JobConfig())
|
||||||
},
|
},
|
||||||
nil,
|
func() (*aurora.Response, bool) {
|
||||||
|
getTaskResp, err := r.client.GetTasksStatus(
|
||||||
|
context.TODO(),
|
||||||
|
&aurora.TaskQuery{JobKeys: []*aurora.JobKey{auroraJob.JobKey()}},
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks := response.ScheduleStatusResult(getTaskResp).GetTasks()
|
||||||
|
if len(tasks) != int(auroraJob.GetInstanceCount()) {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, true
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
if retryErr != nil {
|
if retryErr != nil {
|
||||||
|
|
7
retry.go
7
retry.go
|
@ -197,9 +197,12 @@ func (r *realisClient) thriftCallWithRetries(
|
||||||
// Allow caller to provide a function which checks if the original call was successful before
|
// Allow caller to provide a function which checks if the original call was successful before
|
||||||
// it timed out.
|
// it timed out.
|
||||||
if verifyOnTimeout != nil {
|
if verifyOnTimeout != nil {
|
||||||
resp, ok := verifyOnTimeout()
|
verifyResp, ok := verifyOnTimeout()
|
||||||
if ok {
|
if ok {
|
||||||
return resp, nil
|
r.logger.debugPrint("verified that the call went through successfully")
|
||||||
|
// Response might be different than the original.
|
||||||
|
return verifyResp, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue