async-await Questions

4

Solved

I recently had to correct security issues in a web-application (that I didn't create). The security problem was, it was using non-http-only cookies. So I had to set the session-cookie http-only, ...
Centrosome asked 1/2, 2017 at 9:51

2

I'm trying to retry a failed operation 3 times. I'm using Polly for a retry operation. I want to get the exception in case the retry operation fails and retry again 2 times and so on. return await ...
Stricture asked 23/12, 2019 at 13:29

4

Solved

I know that the async await is the new Promise in the town and it is a new way to write asynchronous code and I also know that We didn’t have to write .then, create an anonymous function to handle...
Pavlov asked 28/11, 2017 at 5:52

2

Solved

Say you're writing a custom single threaded GUI library (or anything with an event loop). From my understanding, if I use async/await, or just regular TPL continuations, they will all be scheduled ...
Minion asked 1/9, 2016 at 12:23

3

Solved

I've made Lambda functions before but not in Python. I know in Javascript Lambda supports the handler function being asynchronous, but I get an error if I try it in Python. Here is the code I am tr...

1

Solved

I'm trying to understand how to use an Apple class, without Sendable, in an async context without getting warnings that this won't work in Swift 6. Weapon of choice is NSExtensionContext which I ne...
Elviaelvie asked 12/3 at 15:7

8

I was recently reading some code that uses a lot of async methods, but then sometimes needs to execute them synchronously. The code does: Foo foo = GetFooAsync(...).GetAwaiter().GetResult(); Is ...
Newsprint asked 24/6, 2013 at 20:28

3

Solved

I know that we wait with await and execute a task without need to wait with async let, but I can't understand the difference between these two calls: async let resultA = myAsyncFunc() async let res...
Debark asked 8/3 at 7:32

3

Solved

i have similar architecture in my app. computed(){ someStoreValue = this.$store.someStoreValue; } watch() { someStoreValue() = async function () { //do some async action } }, methods: {...
Devanagari asked 31/7, 2020 at 8:33

7

I'm writing a discord bot using discord.py rewrite, and I want to run a function every day at a certain time. I'm not experienced with async functions at all and I can't figure out how to run one w...
Baptistery asked 26/7, 2018 at 2:10

5

Solved

I've discovered that TaskCompletionSource.SetResult(); invokes the code awaiting the task before returning. In my case that result in a deadlock. This is a simplified version that is started in an...

7

Solved

I'm using async/await and Task a lot but have never been using Task.Yield() and to be honest even with all the explanations I do not understand why I would need this method. Can somebody give a goo...
Yaya asked 25/3, 2014 at 20:0

4

Solved

Given a method such as public async Task<Task> ActionAsync() { ... } What is the difference between await await ActionAsync(); and await ActionAsync().Unwrap(); if any.
Solemnize asked 15/1, 2016 at 17:32

5

Solved

I'm using UDPClient like below dim c = New UDPClient(port) client.CLient.ReceiveTimeout = 1 await client.ReceiveAsync() However the await does not terminate or throw even though I have set a ti...
Instrument asked 28/9, 2012 at 10:19

4

I've always seen Promise work with setTimeout, but I'm trying to make it based on whatever the chrome.runtime.sendMessage returns to the Promise. I've got a content script that does this function ...

3

Solved

I start by saying that I am not 100% sure this is the problem, I mean using await and async. This is the scenario: I run this when I first load the page, and works fine, I get the data: e...
Langsyne asked 1/3, 2019 at 19:7

22

Solved

At the moment, I'm attempting to use async/await within a class constructor function. This is so that I can get a custom e-mail tag for an Electron project I'm working on. customElements.define('e...
Slattery asked 15/4, 2017 at 21:41

6

Solved

In asynchronous JavaScript, it is easy to run tasks in parallel and wait for all of them to complete using Promise.all: async function bar(i) { console.log('started', i); await delay(1000); con...
Plumbism asked 20/12, 2015 at 2:7

5

Solved

First some context, I have an async function which logs messages on a MongoDB database. async function log_message(sender, conversationId, text) { try { const msg = new Message({ sender: sender...
Countryman asked 28/1, 2020 at 17:19

5

Solved

My goal was to make multiple api calls for a list of data. Lets say I had the following code const axios = require('axios'); const axiosRequests = []; const strings = ['a', 'b', 'c']; for (let s...
Instauration asked 3/5, 2020 at 4:30

10

Solved

I have a method that looks like this: private async void DoStuff(long idToLookUp) { IOrder order = await orderService.LookUpIdAsync(idToLookUp); // Close the search IsSearchShowing = false; }...
Overcapitalize asked 7/1, 2013 at 22:57

17

Solved

I have been going over async/await and after going over several articles, I decided to test things myself. However, I can't seem to wrap my head around why this does not work: async function main()...
Deflagrate asked 1/10, 2017 at 18:55

0

I needed to use cache in a web application built in Python. Since I couldn’t directly use lru_cache in a coroutine, I built a simple decorator that would allow me to use it: from asyncio import Loc...
Foushee asked 11/2 at 19:50

3

Solved

I have implemented the MVP (MVC) pattern in c# winforms. My View and Presenter are as follows (without all the MVP glue): public interface IExampleView { event EventHandler<EventArgs> Sav...
Slumlord asked 16/6, 2016 at 11:22

11

function first(){ console.log('first') } function second(){ console.log('second') } let interval = async ()=>{ await setInterval(first,2000) await setInterval(second,2000) } interval(); Im...
Borszcz asked 5/9, 2018 at 11:40

© 2022 - 2024 — McMap. All rights reserved.