-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use assertion function #7433
base: priority
Are you sure you want to change the base?
Use assertion function #7433
Conversation
afbac2f
to
f304fa0
Compare
@@ -178,7 +183,7 @@ func (tm *priTaskMatcher) forwardTasks(lim quotas.RateLimiter, retrier backoff.R | |||
if res.ctxErr != nil { | |||
return // task queue closing | |||
} | |||
bugIf(res.task == nil, "bug: bad match result in forwardTasks") | |||
softassert.That(tm.logger, res.task != nil, "expected a task from match") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should continue or return on failure, otherwise it'll just panic immediately
@@ -247,11 +252,13 @@ func (tm *priTaskMatcher) validateTasksOnRoot(lim quotas.RateLimiter, retrier ba | |||
if res.ctxErr != nil { | |||
return // task queue closing | |||
} | |||
bugIf(res.task == nil, "bug: bad match result in validateTasksOnRoot") | |||
softassert.That(tm.logger, res.task != nil, "expected a task from match") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this too
@@ -276,7 +283,7 @@ func (tm *priTaskMatcher) forwardPolls() { | |||
if res.ctxErr != nil { | |||
return // task queue closing | |||
} | |||
bugIf(res.poller == nil, "bug: bad match result in forwardPolls") | |||
softassert.That(tm.logger, res.poller != nil, "expected a poller from match") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to continue or return
@@ -324,7 +331,7 @@ func (tm *priTaskMatcher) forwardPolls() { | |||
func (tm *priTaskMatcher) Offer(ctx context.Context, task *internalTask) (bool, error) { | |||
finish := func() (bool, error) { | |||
res, ok := task.getResponse() | |||
bugIf(!ok, "Offer must be given a sync match task") | |||
softassert.That(tm.logger, ok, "expected a sync match task") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to return error?
@@ -410,7 +414,7 @@ func (tr *priTaskReader) signalNewTasks(resp subqueueCreateTasksResponse) { | |||
// adding these tasks to outstandingTasks. So they should definitely not be there. | |||
for _, t := range resp.tasks { | |||
_, found := tr.outstandingTasks.Get(t.TaskId) | |||
bugIf(found, "bug: newly-written task already present in outstanding tasks") | |||
softassert.That(tr.logger, !found, "newly-written task already present in outstanding tasks") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably do a slices.DeleteFunc and remove the ones that are found
softassert.That(tr.logger, found, "completed task not found in oustandingTasks") | ||
softassert.That(tr.logger, !wasAlreadyAcked.(bool), "completed task was already acked") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably just return if either of these are true?
What changed?
Why?
How did you test it?
Potential risks
Documentation
Is hotfix candidate?