Orchardcore: Consider making StartupBase.ConfigureServices/Configure async

Created on 22 Dec 2016  路  7Comments  路  Source: OrchardCMS/OrchardCore

Both Configure and ConfigureServices could be updated to be Task-returning (and truly async as they are called from asynchronous methods). This would be useful in the OpenID module.

/cc @sebastienros @jersiovic

discussion enhancement

Most helpful comment

there is a high likelihood of ConfigureServices doing something that needs to be async. eg reading config from something that is IO bound. So it should absolutely support a Task based approach

All 7 comments

OMG, I was thinking about it during my commute! Because we own the calls and could just accept any.

If you like the change, I can send a PR (it seems trivial to do).

The guys in the team don't like it as it could give a wrong idea that it's actually doing something async, but it's not. We agree that it's only for style?

Well maybe not in our cases as our Startups don't have the same semantics as the standard one. The standard one is called by Main on the startup request, ours can be called standard requests to load a tenant.

The guys in the team don't like it as it could give a wrong idea that it's actually doing something async, but it's not. We agree that it's only for style?

Well, it's also to avoid blocking on async calls :smile:

If you think it's confusing, maybe it would be worth having a third method, InitializeAsync, that would be called before the two other ones.

The standard one is called by Main on the startup request, ours can be called standard requests to load a tenant.

Yeah, that's exactly why I opened this thread (it wouldn't make much sense if the entire thing wasn't async).

there is a high likelihood of ConfigureServices doing something that needs to be async. eg reading config from something that is IO bound. So it should absolutely support a Task based approach

How about having both sync and async overloads (also for backwards compatibility)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deanmarcussen picture deanmarcussen  路  3Comments

szilardcsere89 picture szilardcsere89  路  3Comments

aghili371 picture aghili371  路  3Comments

webmedia1012 picture webmedia1012  路  4Comments

jeffolmstead picture jeffolmstead  路  4Comments