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

Add missing return to fix analysis #62

Merged
merged 3 commits into from
Aug 3, 2018
Merged

Add missing return to fix analysis #62

merged 3 commits into from
Aug 3, 2018

Conversation

keertip
Copy link
Contributor

@keertip keertip commented Aug 3, 2018

Tested with bleeding edge.

@keertip keertip requested a review from nex3 August 3, 2018 20:45
@@ -59,12 +59,13 @@ class AsyncQueue<T> {
/// the process was cancelled.
Future _processNextItem() {
var item = _items.removeFirst();
return _processor(item).then((_) {
return _processor(item).then((_) async {
if (_items.isNotEmpty) return _processNextItem();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the method is async, this should be return await. Otherwise it's easy to accidentally refactor without realizing this is asynchronous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

if (_items.isNotEmpty) return _processNextItem();

// We have drained the queue, stop processing and wait until something
// has been enqueued.
_isProcessing = false;
return await null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the other return should be return await. There's no use in awaiting null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that, fixed.

@keertip keertip merged commit 539ed40 into master Aug 3, 2018
@keertip keertip deleted the returns branch August 3, 2018 23:26
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.

None yet

3 participants