Skip to content

Refactor and merge datastore head task pollers. #320

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

Merged
merged 1 commit into from
Aug 30, 2017

Conversation

isoos
Copy link
Collaborator

@isoos isoos commented Aug 29, 2017

The benefit is slim right now, but later on the dartdoc service should be able to use the shared one right out of the box.

Copy link
Member

@mkustermann mkustermann left a comment

Choose a reason for hiding this comment

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

looks fine

(though it's kind of surprising that it adds twice as many lines as it removes)

yield task;
}
}
await reportTurnDone(count);
Copy link
Member

Choose a reason for hiding this comment

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

Move this statement to the call site.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean that counting the Stream's length at one level up? To make things less complicated, I think we could operate without the count.

}
await new Future.delayed(const Duration(minutes: 1));
}
Future<bool> shouldYieldTask(Task task) async {
Copy link
Member

Choose a reason for hiding this comment

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

Normally I would prefer separating these concerns via composition rather than inheritance, e.g. new FilteredTaskSource(new DatastoreHeadTaskSource()).

_lastTs = now.subtract(const Duration(minutes: 10));
await new Future.delayed(new Duration(minutes: 30));
}
Future reportTurnDone(int count) async {
Copy link
Member

Choose a reason for hiding this comment

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

The name does not seem to be very descriptive, maybe dbScanComplete or something like that.

@isoos isoos force-pushed the shared_task_sources branch from c895ad3 to 0f8960c Compare August 30, 2017 13:40
@isoos
Copy link
Collaborator Author

isoos commented Aug 30, 2017

Normally I would prefer separating these concerns via composition rather than inheritance, e.g. new FilteredTaskSource(new DatastoreHeadTaskSource()).

What would you think about shouldYieldTask and dbScanComplete to become Functions passed in the DatastoreVersionsHeadTaskSource class?

@mkustermann
Copy link
Member

Normally I would prefer separating these concerns via composition rather than inheritance, e.g. new
FilteredTaskSource(new DatastoreHeadTaskSource()).

What would you think about shouldYieldTask and dbScanComplete to become Functions passed in the > DatastoreVersionsHeadTaskSource class?

Let's just stick with this version for the sake of making progress. It was just a note/recommendation, since composed code is much easier to read/understand than using subclasses.

@mkustermann mkustermann merged commit 3c21dbd into dart-lang:master Aug 30, 2017
@isoos isoos deleted the shared_task_sources branch September 1, 2017 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants