Skip to content
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

Draft
wants to merge 1 commit into
base: priority
Choose a base branch
from

Conversation

stephanos
Copy link
Contributor

What changed?

Why?

How did you test it?

Potential risks

Documentation

Is hotfix candidate?

@@ -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")
Copy link
Member

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")
Copy link
Member

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")
Copy link
Member

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")
Copy link
Member

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")
Copy link
Member

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

Comment on lines +452 to +453
softassert.That(tr.logger, found, "completed task not found in oustandingTasks")
softassert.That(tr.logger, !wasAlreadyAcked.(bool), "completed task was already acked")
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants