apache/openwhisk-runtime-dotnet

Add async/await support

Closed this issue · 8 comments

It should be possible to define method like this:
public Task<JObject> Main(JObject args)

That's very common definition in ASP.Net.

It's also the case in Amazon Lambdas and Azure Functions

If you are using .NET asynchronous programming, the return type can be Task and Task types and use async and await keywords.

Thanks @kamyker - are you interested in submitting a pull request for this?

@rabbah Maybe, any ideas how long it would take IBM to update their image after pr gets accepted? Or maybe I'd be able to make custom docker image and use it instantly instead?

You’d need to ask ibm :)

As an Apache project we’d love the contribution, which you could then build and push to dockerhub and use independent of the ibm lifecycle.

Tried building and running OpenWhisk but failed as it looks like it may not even work on windows apache/openwhisk-devtools#119 I gave up. Pull itself is trivial but getting test environment seems overwhelming.

I'm not sure the best way to go about this, but I believe I can implement it, but is it reasonable to wait until #20 is accepted?

I think waiting on merging #20 before working on this new feature is reasonable.

Btw if someone needs async before this feature is available (for ex. in IBM) it's possible to instead:
var result = await SomeAsyncFunc();
do:
var result = SomeAsyncFunc().GetAwaiter().GetResult();
Not very efficient as it will use new thread and can prob deadlock in very high usage scenarios but fine in my use case.

@kamyker are you able to review this PR #25 which adds async support? It would be much appreciated 🙏 if you can take a look.