Questions tagged [async-await]

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

47 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
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 ...
6
votes
0answers
60 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 ...
5
votes
0answers
50 views

SQS subscriber pattern in background service

I have the below code to pull messages from a FIFO SQS queue. Using the while (IsRunning) loop makes me feel to question the code design. Is there a pattern I am ...
5
votes
0answers
133 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 ...
5
votes
0answers
2k 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 ...
4
votes
0answers
56 views

Wrap a callback method in an awaitable method

I'm using a .NET library which uses a pre-async/await type of asynchronicity. That is, it provides asynchronous (non-awaitable) method with a callback parameter. I'm trying to write awaitable ...
4
votes
0answers
99 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 ...
4
votes
0answers
219 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 ...
4
votes
0answers
75 views

pool of python coroutines

Task control how much coroutines are running simultaneously with ability to stop the process from inside. Use case when scraping websites you want to control how much memory program consumes and ...
3
votes
0answers
49 views

Communication with interactive program using ChildProcess

There is an interactive program, namely Microchip Debugger (Later called MDB), which I want to communicate with from NodeJS program. You can think about it as any console-based debugger - they all do ...
3
votes
0answers
224 views

TCP client reading socket asynchronously

I'm relatively new to .Net/UWP networking and have been trying to make sense of the APIs. I'd like to implement a TCP client that is capable of reading and sending messages independently (there is no ...
3
votes
0answers
822 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'...
3
votes
0answers
44 views

Coordination function

This function started very clean but I had to add requirements: Added a Stopwatch to only update the caller periodically. I guess that responsibility could be ...
3
votes
0answers
338 views

Blocking Promise-driven queues with ECMAScript's async/await and generators

I implemented an AsyncQueue, whose dequeue() operation returns a Promise. The ...
3
votes
0answers
172 views

Minimal Async Web Server in Rebol 2

I'm building a rudimentary web server in Rebol 2. I'm trying in particular to understand the flow and logic behind the asynchronous aspects of the TCP scheme. As far as I can understand it, you ...
2
votes
0answers
71 views

Scheduler built with observables v3 (follow-up) - now testable

This is a 2nd follow-up to my previous one about a Scheduler built with observables. Although the last one was working correctly, it was only possible to see this ...
2
votes
0answers
33 views

Porting python's 'with' construct to TypeScript

Now that async generators are available in the platforms I care about, I figured I'd try porting Python's ingenious with construct to JS as a utility. My first stab ...
2
votes
0answers
50 views

Conditional AsyncLock implementation

I have a case where I match data from DB by the various filters. Until the match is updated in the DB, I don't want to accept requests for matching with the same criteria, as this could produce ...
2
votes
0answers
226 views

React widget to display, sort and search remote data

I've created a React widget that pulls data on crypto-token pairs from a remote API and makes that data sortable by headers and searchable. You can view a demo of it here. Is this a maintainable way ...
2
votes
0answers
160 views

Server app: pinging up to 500 clients asynchronyosly

TCP/IP server which controls up to 500 clients. There's a list of added computers and the server gets this list, selects computers which are not already connected and ping them using host name. ...
2
votes
0answers
663 views

Async/await Mysql wrapper

I used MySQL, but it was inconvenient so I made a wrapper. It works, but I'm unsure if there are any issues. Used node module - mysql2, bluebird sqlWarpper.js ...
2
votes
0answers
180 views

asyncio with live update and abort capabilities

This is my first shot at asyncio. I'm looking for any pointers you might have. Especially: Are there any race conditions? This code doesn't scale as expected. In ...
2
votes
0answers
307 views

Promise-based unit tests using Pub/Sub

I've recently been learning and adopting Promises, async/await, and unit testing for my JavaScript server project. I just finished a unit test for some pubsub code that was more convoluted than ...
2
votes
0answers
152 views

Establishing a TCP connection with async & await

I'm not really super experienced async/await and working with tasks, so I thought I'd ask for some other opinions. I'm working with code written by someone else that establishes a TCP connection. It ...
2
votes
0answers
123 views

Multithreaded download of images from a spreadsheet

I've been wanting to go async with my HTTP calls but all the methods I tried have not worked, so I resolved to implement this as a task and then improve upon it. This is what I've come up with so far....
2
votes
0answers
437 views

Implementing TAP around WMI

I'm trying to improve my skills with the Task-based Asynchronous Pattern (TAP), by writing simple task-based wrappers around some WMI methods: ...
1
vote
0answers
18 views

Custom hook to handles async calls with loading and error state?

I have built this hook to handle async calls. It should manage state for the loading and ...
1
vote
0answers
11 views

Functions to handle async calls and also handle loading and error status in React component

I've got the following component structure: Component hierarchy: <AdminBlogPostContainer> <AdminBlogPostPage> <BlogPostForm> ...
1
vote
0answers
14 views

DB2 monitor using idb-connector

Monitors DB2 for changes in table data. It doesn't take any actions with the data just yet, only checks to see if new data is available every 2 seconds. ...
1
vote
0answers
97 views

Implicit Async and none async event handlers

I have implemented a event aggregator for our backend. ...
1
vote
0answers
73 views

Putting a Queue Between HTTP Request/Response

We currently have two legacy systems: the Consumer and the Worker. These systems are massively complex in ways that are not important to this review, but it is enough to say that a large-scale re-...
1
vote
1answer
168 views

Parallel FTP client

I was given the task to download files for a FTP server. The download should be fairly fast. 15 parallel connections can be used. I have used FluentFTP as the ...
1
vote
0answers
225 views

Async SelectMany implementation

Async SelectMany takes an enumeration (length unknown) of tasks, each of which returns another enumeration (length unknown and likely different from one another), and returns results from the second ...
1
vote
0answers
155 views

Using up to 15 connections to synchronize files from a FTP server with local files

Task: Create a service which will synchronize files on FTP server with files on local drive. FTP server allows up to 15 concurent connections Synchronize the files as fast as possible Files on FTP ...
1
vote
0answers
61 views

Async API Function with Mongoose

I'm quite new to the language and I just started using async/await. I've written this function for an API that I'm developing. It checks what is sent by the user, specially the status that he wants to ...
1
vote
0answers
85 views

Creating a menu for a quiz

I've built a menu for a quiz, where everything is hard-coded apart from the categories, which I'm pulling from an API using Axios. Api.js ...
1
vote
0answers
242 views

TaskQueue implementation

To overview async tasks as "Loading configuration", "Saving configuration" and "Discarding configuration" I created a TaskQueue type. I want to be able to schedule ...
1
vote
0answers
3k views

Using async/await with Node.JS MySQL

Is this the right way to use async/await with the JavaScript MySQL client? I had to use the promise-mysql package because it wraps the function calls with Bluebird promises, so that I'm able to use ...
1
vote
0answers
847 views

Handling Tasks to read HttpRequestMessage in an Azure Function App

I am writing an Azure function app to receive a file uploaded through a multipart/form-data HTML form. I think the only way to get my uploaded data is by probing ...
1
vote
0answers
82 views

AsyncLock implementation for JS

I made an AsyncLock implementation due to a comment on Hacker News saying JavaScript was missing such a necessary idea. I honestly am not terribly familiar with Threaded programming and the concept of ...
1
vote
0answers
2k views

Navigate a WebBrowser control asynchronously

I wrote a little method to navigate a WebBrowser control asynchronously and returns DocumentResult, yet i wanna know if this is ...
1
vote
0answers
111 views

Remove array items in an array in a CouchDB document

In this project I'm working with NoSQL databases (couchdb) and Node.JS using ES7 (via Babel). This is my code to remove items from an array of addresses in a JSON document. If you see something that ...
1
vote
0answers
385 views

WebAPI async task pattern, with IDbContextScopeFactory and automapper

I normally abstract data access code into another layer, but I'm currently prototyping and it's not necessary. Does anyone see any issues with this as a general data query pattern, considering the ...
1
vote
0answers
2k views

Indefinite loop in a coroutine vs. re-scheduling a coroutine

I recently started working with asyncio and coroutines. I have a coroutine that runs every 0.25 seconds to print "running ..." on screen indefinitely. When the script receives a SIGTERM or SIGINT it ...
0
votes
0answers
59 views

Aggregate sensor readings from multiple sources

I've developed a toy example to investigate how async works in C#. Though I've learned a lot this week, I'm still unsure of the finer details, as this is my first C#...
0
votes
0answers
106 views

An `async..await` based way to handle the output of a child process

I've recently answered a question on Stack Overflow where the asker was wondering how to read from the standard out of a child process he was spawning inside a ...
-1
votes
1answer
932 views

Ado.Net and Async insert of many rows to db

I have implemented repository in Ado.Net which insert data to many tables. I insert all in one transaction and use async/await to improve performances. If you have any suggestions have to improve my ...