asynchronous

Choosing not to await async function in action in ASP.NET Core WebAPI controller

假装没事ソ 提交于 2021-01-27 08:01:44
问题 The scenario is the following: Backend: Asp.NET Core WebAPI 2.2 Frontend: iOS and Android which consumes the API I have a function allowing the user to send messages to other users. The sending of a message is done in an asynchronous action: public async Task<IActionResult> CreateMessage This action does the following in order: Validation Awaits persistance of the message to DB Awaits the notification of relevant clients via SignalR Doesn't await the sending of push notification via Azure

Choosing not to await async function in action in ASP.NET Core WebAPI controller

徘徊边缘 提交于 2021-01-27 08:01:03
问题 The scenario is the following: Backend: Asp.NET Core WebAPI 2.2 Frontend: iOS and Android which consumes the API I have a function allowing the user to send messages to other users. The sending of a message is done in an asynchronous action: public async Task<IActionResult> CreateMessage This action does the following in order: Validation Awaits persistance of the message to DB Awaits the notification of relevant clients via SignalR Doesn't await the sending of push notification via Azure

How does Task.Delay work exactly?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 07:36:27
问题 They say Task.Delay() is an async Thread.Sleep(). To test this I wrote below code. I expect to print immediately "One" then 3 seconds later result variable (15) will be printed. 2 seconds after this, "Two" will be printed. But it doesnt seem so. "One" is not immediately printed. "One" is printed 3 seconds later. Why does it wait 3 seconds to print "One" ? using System; using System.Threading; using System.Threading.Tasks; namespace ConsoleApplication31 { class Program { public static int

How does Task.Delay work exactly?

帅比萌擦擦* 提交于 2021-01-27 07:35:49
问题 They say Task.Delay() is an async Thread.Sleep(). To test this I wrote below code. I expect to print immediately "One" then 3 seconds later result variable (15) will be printed. 2 seconds after this, "Two" will be printed. But it doesnt seem so. "One" is not immediately printed. "One" is printed 3 seconds later. Why does it wait 3 seconds to print "One" ? using System; using System.Threading; using System.Threading.Tasks; namespace ConsoleApplication31 { class Program { public static int

Async Lambda Function: Returning promise or sending responseURL does not terminate CloudFormation custom resource invocation

 ̄綄美尐妖づ 提交于 2021-01-27 07:15:19
问题 I have a lambda function invoked as a custom resource via a CloudFormation template. It Creates/Deletes AWS Connect instances. The API calls work fine but I cannot seem to terminate the custom resource invocation, so the last CF block remains CREATE_IN_PROGRESS. No matter what I return from the async function it just won't terminate the CF execution with a success. I'm able to use a non-async handler successfully as in https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough

Async Lambda Function: Returning promise or sending responseURL does not terminate CloudFormation custom resource invocation

十年热恋 提交于 2021-01-27 07:12:52
问题 I have a lambda function invoked as a custom resource via a CloudFormation template. It Creates/Deletes AWS Connect instances. The API calls work fine but I cannot seem to terminate the custom resource invocation, so the last CF block remains CREATE_IN_PROGRESS. No matter what I return from the async function it just won't terminate the CF execution with a success. I'm able to use a non-async handler successfully as in https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough

Passing asynchronously acquired data to child props

独自空忆成欢 提交于 2021-01-27 06:52:39
问题 I am making an app that gets an array of news items from a remote source and displays them on a page. I have the endpoint, and can make a successful call, proven by console logs, using $.getJSON() . I placed this call into the parent component, because child components will need to use the data. However, when I pass this data down to a child component, the console error appears: Uncaught TypeError: Cannot read property 'headline' of undefined This is because React is trying to render the

Passing asynchronously acquired data to child props

醉酒当歌 提交于 2021-01-27 06:51:58
问题 I am making an app that gets an array of news items from a remote source and displays them on a page. I have the endpoint, and can make a successful call, proven by console logs, using $.getJSON() . I placed this call into the parent component, because child components will need to use the data. However, when I pass this data down to a child component, the console error appears: Uncaught TypeError: Cannot read property 'headline' of undefined This is because React is trying to render the

C#: Question about socket programming (sync or async)

喜夏-厌秋 提交于 2021-01-27 06:43:40
问题 I'm writing an instant messaging server in C# for learning purposes. My question is whether I should use synchronous or asynchronous sockets to handle the IM clients. The goal is to handle as many clients as possible. I'm not quite sure but as far as I know with async sockets the packets don't arrive in order which means when you send 2 chat messages and there is a delay/lag it's possible that the second one arrive before the first one. Is this right and if so, is there a way to solve this

C#: Question about socket programming (sync or async)

懵懂的女人 提交于 2021-01-27 06:39:23
问题 I'm writing an instant messaging server in C# for learning purposes. My question is whether I should use synchronous or asynchronous sockets to handle the IM clients. The goal is to handle as many clients as possible. I'm not quite sure but as far as I know with async sockets the packets don't arrive in order which means when you send 2 chat messages and there is a delay/lag it's possible that the second one arrive before the first one. Is this right and if so, is there a way to solve this