Skip to main content

Questions tagged [async-await]

This covers the asynchronous programming model supported by various programming languages, using the async and await keywords.

Filter by
Sorted by
Tagged with
44 votes
3 answers
6k views

Simon Says: "Make me a pretty game"

In Memoriam Ralph H. Baer, co-inventor of the original "Simon" game, died Saturday December 6th 2014, at 92. With his passing, this friendly little challenge inadvertently became a memorial to ...
Mathieu Guindon's user avatar
28 votes
1 answer
76k views

Use of Async/Await for EventHandlers

I have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container. ...
MoonKnight's user avatar
23 votes
2 answers
350 views

RubberduckParser 2.0 - Asynchronous Parsing

The IRubberduckParser interface has seen breaking changes, and now looks like this: ...
Mathieu Guindon's user avatar
14 votes
2 answers
44k views

Using async / await with dynamic import() for ES6 modules

I am experimenting with the best way to standardise my dynamic import() expressions when importing javascript modules. import() ...
Rounin's user avatar
  • 409
14 votes
2 answers
5k views

Asynchronous Circular Buffer in C#

Preamble I want to be able to test methods which communicate over a simple exclusively asynchronous two-way stream-like interface which may underneath use any of a number of communication methods (e....
VisualMelon's user avatar
  • 7,431
14 votes
2 answers
7k views

Implementation of Asynchronous Cache

I have been attempting to implement a cache which caches the results of an asynchronous method, with the restriction that I only want that method to run once for any particular item in the cache. Many ...
bornfromanegg's user avatar
13 votes
1 answer
27k views

Filtering a collection by an async result

I'm trying to do something like this: var loudDogs = dogs.Where(async d => await d.IsYappyAsync); The "IsYappyAsync" property would return a ...
mbursill's user avatar
  • 233
13 votes
0 answers
3k views

Socket application using TPL

This is an application I wrote that allows multiple TCP clients to share a single TCP connection to a remote server (hosted project, and a demo). Traffic generated by the server is forwarded to all ...
KFL's user avatar
  • 231
12 votes
3 answers
411 views

Async insecurities

I feel like I'm overdoing the async await stuff. I'm just learning. Maybe this isn't the best instance to be using this stuff. I have a system with sensors that detect the completion of some action....
J Dub's user avatar
  • 223
12 votes
2 answers
3k views

Async wrapper around public API

Tear it apart. I'm mostly concerned around the appropriate use of ConfigureAwait(false), and possible poor handling and duplication of the ...
Prescott's user avatar
  • 225
12 votes
2 answers
913 views

Stack Exchange websockets wrapper

I've been writing a small library that allows for easy querying of the Stack Exchange websockets. I'm going to add an enum to replace the manual ...
Jeroen Vannevel's user avatar
12 votes
2 answers
17k views

Get values from Web service asynchronously

I am working on creating some libraries for a project at work and I wanted to make sure I have this pattern correct. Assuming that the GetWidgets() method is what I ...
Schandlich's user avatar
11 votes
3 answers
707 views

Asynchronously scrape fabric information

This is my first asyncio/aiohttp web scraper. I am trying to wrap my head around Python's asyncio/aiohttp libs these days and I am not sure if I fully understand it or not yet. So I'd like have some ...
dougj's user avatar
  • 111
11 votes
2 answers
16k views

Console chat server

I'm just looking for feedback on correctness of my understanding of async/await. I'm curious about the Task.Run inside of the ...
jeremywho's user avatar
  • 253
11 votes
2 answers
3k views

NewtonSoft Json.Net serialiser

I'm just starting to develop more in C# after being mainly a VB.NET developer and was looking for someone to critique my implementation of a NewtonSoft Json.Net serialiser. Can you provide some ...
Phil Murray's user avatar
11 votes
2 answers
4k views

Asynchronous retry method

I've written an asynchronous retry method as an answer for this question. I'd like to get your opinion of the implementation and whether there are better ways to implement this. You could also ...
NeddySpaghetti's user avatar
11 votes
0 answers
3k views

Sending notifications with Django channels

I have project on Django wich use Django Channels. I use Django Channel for sending notifications to users who are subscribed to articles changes (adding/editing/deleting comments on article). So I'...
KIN1991's user avatar
  • 211
10 votes
4 answers
10k views

AsyncDictionary - Can you break thread safety?

This class is an Async/Await wrapped Dictionary. Of course it doesn't technically implement IDictionary, but the functionality is basically the same as an IDictionary. It achieves similar ...
Christian Findlay's user avatar
10 votes
1 answer
19k views

Async Queue Processing

I have a Queue that needs to try to process when anything updates in it (add, remove or update). However, I don't want any of the callers to wait while the ...
Vaccano's user avatar
  • 317
9 votes
3 answers
308 views

Toggle any application feature ON or OFF

When testing or debugging applications it'd be often useful to be able to run it without certain features like committing things to the database, saving files, sending emails, reading files, executing ...
t3chb0t's user avatar
  • 44.3k
9 votes
1 answer
3k views

Reading one source Stream by multiple consumers asynchronously

The problem was using single Stream from the HTTP response in multiple consumers simultaneously. For example: while data is loading, I want write it to the some ...
aepot's user avatar
  • 2,019
9 votes
1 answer
13k views

Writing highly asynchronous code

I am writing a new web service that will be performing a lot of large data load operations. To do so I am moving the data to a temporary table then merging the data in to the live data via a stored ...
Scott Chamberlain's user avatar
9 votes
1 answer
2k views

WCF using TAP without worrying about timeouts

I really like using the new TAP pattern in .Net 4.5. and I am updating some of my older projects to use it. One of my old patterns was to use EAP with WCF so I could have functions that could take ...
Scott Chamberlain's user avatar
8 votes
3 answers
4k views

await user input with async/await syntax

for clarity: moved here from stackoverflow after being pointed to Code Review being the better place for this question I love async/await and Promises since I got my hands on them. And I might be ...
gaugau's user avatar
  • 191
8 votes
2 answers
3k views

Quicksort async vs serial

I am playing with async and I figured I'd write a parallel implementation of Quicksort while trying to look at various optimizations. I want to keep the generics (...
Bill Barry's user avatar
  • 2,256
8 votes
2 answers
13k views

Listen to multiple RabbitMQ queue by task and process the message

Single app which listen to multiple RabbitMQ queue and process the message. This is working fine but not sure this implementation is right one or I am missing something. Implementation is inspired ...
Mahesh's user avatar
  • 181
8 votes
1 answer
456 views

Operation logger

GitHub, NuGet This component traces execution in a logical order instead of chronological as everybody else :) For example, the following code: ...
Dmitry Nogin's user avatar
  • 6,131
8 votes
2 answers
1k views

Managing python application configuration in a key-value store

For a project we're working on, we need a central place to store the configurations for various applications (they're all headless services running in docker containers so local configuration files or ...
ChrisWue's user avatar
  • 20.3k
8 votes
1 answer
2k views

Async Yield and continue on TaskPool

Using await task.ConfigureAwait(false) is a standard best practice for indicating to the compiler that the continuation does not need to be run on the current ...
Andrew Hanlon's user avatar
8 votes
2 answers
9k views

Retry loop for asynchronous HTTP requests

I've got a method that needs to PUT data to a web API. Sometimes the connection fails, so I needed a way to do retries, but if the retries fail, I still need to capture the exception and re-throw it. ...
Chase Florell's user avatar
8 votes
1 answer
15k views

C# 5 Async Await .Task.Factory.StartNew cancellation

I have the async code that implements cancellation token. It's working but Im not pretty sure if this is the right way to do it so I just want feedback about it. Here is the actual code: ...
VAAA's user avatar
  • 181
8 votes
1 answer
262 views

Creating API clients that are "async agnostic"

Python3's async/await syntax is great, but it does create a divide between libraries which are async-based and those which are ...
samfrances's user avatar
8 votes
2 answers
2k views

Using keywords async/await in database queries (Windows Phone 8)

I have a local database in Windows Phone 8 app. The app includes a lot of queries to the database and I don't want bad effect on the responsiveness of UI. For ...
Alexandr's user avatar
  • 371
8 votes
1 answer
520 views

Looping until browser document is ready

I made a do...while loop in order to wait for the web browser to load completely in order to enter username and password. I don't know whether this impacts the ...
thomasxd24's user avatar
7 votes
1 answer
35k views

Starting a fire and forget async method

Sonar/FxCop are telling us that we shouldn't use void async methods. That's ok. This is the current implementation: ...
seveves's user avatar
  • 403
7 votes
2 answers
19k views

Task timer async

I had been still using BackGroundWorker and decided to learn async Task. My test project is a simple timer that can be canceled. The target project is to read instruments with a delay for sampling. ...
paparazzo's user avatar
  • 6,016
7 votes
2 answers
64k views

Async/await in Parallel.ForEach

I have a Timer: var QueryReportTimer = new Timer(QueryReportTimerCallback, null, TimeSpan.Zero, TimeSpan.FromSeconds(15)); ...
Raskolnikov's user avatar
7 votes
2 answers
630 views

Network helper class with retry logic on failure

I wrote an helper class which allow me to request the body content from a site that is created by AJAX, for doing so I'm using <...
sfarzoso's user avatar
  • 137
7 votes
3 answers
4k views

Downloading blobs asynchronously

We have a working implementation that is doing I/O operations, returning data from blobs in an async/await manner from Azure Blob Storage. ...
Mihai Neagoe's user avatar
7 votes
2 answers
10k views

Async and error-handling

I need to delete a file when an error occurs during loading it. It is not allowed to perform async operations in a catch block. This has lead me to writing the following code: ...
thumbmunkeys's user avatar
7 votes
3 answers
226 views

Notifying the UI that Issues Were Found

Our Rubberduck VBA IDE Add In does some static code analysis, and then reports all of the found issues back in a gridview. This analysis can take a long time for larger projects and the UI appeared to ...
RubberDuck's user avatar
  • 30.8k
7 votes
3 answers
739 views

Visitor Pattern/Leaky Bucket variant implementation to run an operation at a certain interval

My code is a variant on the Visitor Pattern and a "leaky bucket" variant. The goal is pretty straightforward: the "bucket" will collect a specified number of items (say, for example, 500) and then ...
EJoshuaS - Stand with Ukraine's user avatar
7 votes
1 answer
15k views

Getting messages asynchronously using MailKit

I'm writing a prototype for an application that uses MailKit and imap to connect to gmail. It's the first time I've used MailKit and I'm a bit stumped around the best way to do this. Essentially, I ...
Leigh Shepperson's user avatar
7 votes
1 answer
5k views

Async TCP client/server

I'm working on a simple async TCP client server application, i'd like my network code to be reviewed. I really feel that I'm doing something wrong, especially in receiving code. Interface for client: ...
HardLuck's user avatar
  • 175
7 votes
2 answers
97 views

Cancellable UI loader

I'm playing with async/await, but I have yet to discover a standard method to safely cancel an intensive task. I have tested the following, and it works exactly as intended, though I remain unsure if ...
Avenicci's user avatar
  • 143
7 votes
1 answer
4k views

Python: Asyncio object-oriented style

I'm seeking a review of some code I've written for a small personal project. The project is not yet mature enough for any domain specific details to be of concern - but I'm happy to provide further ...
Adam Hodgson's user avatar
7 votes
1 answer
2k views

Buffered queue for logging

I'd like to use a buffered queue for logging via a WebAPI that handles multiple applications. This helper should reduce the blocking that occures due to logging. I've been experimenting with a ...
t3chb0t's user avatar
  • 44.3k
7 votes
1 answer
5k views

Simple integration of async and tkinter in Python

I've been a fan of coroutines and asynchronous programming for a while, and I recently took a trip down memory lane to when I was using Python's tkinter module for ...
GeeTransit's user avatar
7 votes
1 answer
9k views

Safely executing background tasks in parallel in ASP.NET Core

Context and initial idea I'm trying to teach myself the CQRS and Event Sourcing patterns by developing a simple ASP.NET Core application, loosely following Greg Young's example CQRS implementation on ...
qbicfeet's user avatar
7 votes
0 answers
254 views

Scheduler built with observables v2 (follow-up)

It would probably be too easy if the old Scheduler worked as intended being that simple. But an eye-openig review showed that from time to time it'll miss one ...
t3chb0t's user avatar
  • 44.3k

1
2 3 4 5
7