How to run awaits under async call
See original GitHub issueMy server is like the following:
call.on('data', async (incoming) => {
const result = await something_database_related(incoming...);
call.write(result);
});
call.on('end', () => {
call.end();
});
But i couldn’t get reply from stream as it’s not writing to call. Am i completely wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (6 by maintainers)
Top Results From Across the Web
How to call asynchronous method from synchronous method ...
So here is my workaround: wrap the call inside a Task.Run<>(async () => await FunctionAsync()); and hopefully no deadlock anymore.
Read more >async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ......
Read more >C# calling function asynchronously using Task & Await
Run in button click event · private async void WhenAllButton_Click(object sender, EventArgs e) · { · Task<List<string>> monthNames = SecondTask(); ...
Read more >Async/await - The Modern JavaScript Tutorial
The async keyword before a function has two effects: ... The await keyword before a promise makes JavaScript wait until that promise settles,...
Read more >Using Task.Run in Conjunction with Async/Await | Pluralsight
If a predefined method returns a Task , you simply mark the calling method as async and put the await keyword in front...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
its working now. I dropped first Stream from Request in proto. So i thought i am streaming request why? why?. sad.
There is no
call.request
. I’m guessing you mean that this is handler code on the server, in which case the requests are the objects you’re getting in thedata
handler.