-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
DependsOnAsync, AddTasksAsync and DoAsync naming #305
Comments
We actually had this discussion before with my brother. The problem is that it might be parallel or it might be async. You are looking at the implementation in the TaskBase which is misleading because it's a base class and DoExecuteAsync can be overriden.. For example take implementation of this simple task: protected override async Task<int> DoExecuteAsync(ITaskContextInternal context)
{
await Task.Delay(_delay);
return 0;
} This task is executed with C# asynchronus call. So DependsOnAsync naming is so so. Probably better name would be as you suggested because currently more tasks are really not made with asynchronus calls but in some scenarios it might also be misleading. But there is another problem with DoAsync everything with it will almost surely gona be made with asynchronus calls. protected override void ConfigureTargets(ITaskContext context)
{
context.CreateTarget("Sample").DoAsync(Sample);
}
private async Task Sample(ITaskContext context)
{
var httpClient = new HttpClient();
await httpClient.GetAsync("");
} So we should change DependsOnAsync to DependsOnConcurrent but leave DoAsync? This might also be confusing. I am affraid that here we will not find the "100% right" solution but we can definetly change if there are some really good arguments why should we change or If more people votes for any of the proposed solutions Edit: Oh yea and if we take this scenario: context.CreateTarget("Rebuild")
.SetAsDefault()
.AddTask(x => x.Do(t => { Console.WriteLine("running Rebuild."); }))
.DependsOnAsync(doExample, doExample2)
.DependsOn(test); This is not parallel anymore :) |
With your examples, now I understand more about it, and I don't have better ideas for now. So yeah, maybe we do nothing for now, wait and see if there are more ideas coming up later. |
Maybe also some better explanation on the method documentation (summary). |
If you think or anyone else how could this be explained better in the documentation Asynchronus or parallel execution of tasks, customCode and dependencies or you fell some parts are missing. PR would be more than welcome. Also if anyone have an idea how could we explain this briefly in method documentation please provide a PR :) |
Suggestion from @huanlin :
The text was updated successfully, but these errors were encountered: