question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to run awaits under async call

See original GitHub issue

My 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:closed
  • Created 3 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tweenietomatoescommented, May 21, 2020

its working now. I dropped first Stream from Request in proto. So i thought i am streaming request why? why?. sad.

1reaction
murgatroid99commented, May 21, 2020

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 the data handler.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found