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
0 votes
1 answer
129 views

#Error Handling- Propagating errors to calling function.

Im new to javascript programming and i am required to make a web app. Node.js will be used as the js runtime environment. In order to minimize the amount of time needed for debugging as the app ...
nicholas mitchell's user avatar
4 votes
2 answers
2k views

Initializing multiple variables with different types using parallel calls

Consider the pattern below, where multiple async calls are made in parallel: ...
julealgon's user avatar
  • 224
2 votes
1 answer
68 views

Javascript class to geocode Dutch addresses

I am relatively new to javascript ES6, the code I've written is working fine. However I am curious if this would be the best approach. I am trying to write a reusable module that I can use in multiple ...
Titsjmen's user avatar
  • 158
6 votes
2 answers
6k views

ForEachAsync extension method (a way to run an async operation on each item of a sequence in parallel)

In a recent project I worked on we faced some issues due to an excess of parallelization (thousands of threads were created and the overall result was a degradation of performance and several spikes ...
Enrico Massone's user avatar
2 votes
0 answers
426 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 ...
J.McLaren's user avatar
  • 121
0 votes
1 answer
3k views

Asynchronously fetching data from the database

The following C# code is written to fetch the Categories data from SQL Server Database using Asynchronous Task for HttpGet. The Dapper library is used as ORM. I ...
Coder Absolute's user avatar
4 votes
0 answers
189 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 ...
Illia Ananich's user avatar
5 votes
1 answer
175 views

Async/Await Computation Expression

When writing asynchronous code in F#, one often needs to call methods in the .NET BCL that return Task or Task<T> rather ...
Aaron M. Eshbach's user avatar
2 votes
0 answers
242 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. ...
Dmitrii Polianskii's user avatar
1 vote
1 answer
5k views

Starting a process asynchronous

For executing a Process I've created an separate class which binds the possibilities together, for example reading output, start as Admin, catch Exceptions and also start all this asynchronous. Are ...
Coden's user avatar
  • 111
4 votes
1 answer
431 views

CLI to bump package.json version and add git tags

I'm writing a command line app in node.js. At this stage, the app does the following: Get the version from package.json Update the package.json with a new version ...
shreyasminocha's user avatar
5 votes
1 answer
9k views

Asynchronous dictionary in Python

So I am working on writing a discord bot with discord.py. I decided, rather than making a serie of if/elif, to map the messages to the functions in a dictionnary, like so: ...
Yoiro's user avatar
  • 153
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
2 votes
0 answers
874 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 ...
AKIMOTO TAKUMI's user avatar
6 votes
1 answer
3k views

Increase speed of Google Drive upload for large files

I'm using Google Drive API for uploading large disk image files ( >100 GB). My Code uses this wrapper to upload these large files in chunks of 40mb. The files are stored on NAS drive. The code works ...
Brendan Gooden's user avatar
2 votes
1 answer
1k views

Return combined DTO from async controller

I have an asynchronous controller. It is supposed to make a couple async calls then return combined data from then as one DTO. ...
szpic's user avatar
  • 187
4 votes
0 answers
63 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 ...
user875234's user avatar
3 votes
1 answer
12k views

Simple server using async and HttpListener

I have a program that controls a custom machine. I wanted to add some simple HTTP comms so I could control it from the network or other programs. My server class is: ...
geometrikal's user avatar
-5 votes
1 answer
157 views

Optimal way to iterate between await operator calls

Is there any cleaner way to implement the following? ...
user875234's user avatar
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
-2 votes
1 answer
52 views

Convert this method into parallel await [closed]

I am using Node.js. I have two different classes. The first one is called Controller, the second is called ServerCommunicator. Controller calls a method in SC (sendDataToDolibarrAsync), which takes a ...
Phrosen's user avatar
  • 111
5 votes
2 answers
348 views

Asynchronously fetching Bitcoin orders and quotes

I have the following code to get data using async/await ...
Jean's user avatar
  • 161
6 votes
1 answer
5k views

Process List asynchronously with SemaphoreSlim for throttling extension method

I've got some methods that follow a similar pattern, and wanted to abstract some of the logic away into an extension method. Specifically, I am processing lists of objects with the TPL, and throttling ...
JohnWick's user avatar
  • 425
5 votes
1 answer
146 views

Scheduling using System.IObservable 2.0

As a follow up to this first attempt to create and use my own IObservable<T> implementation, this is version 2.0. The goal has been to correct the code where ...
user avatar
0 votes
1 answer
3k 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 ...
Raskolnikov's user avatar
4 votes
1 answer
159 views

Scheduling using System.IObservable

With great inspiration from t3chb0ts ongoing work about scheduling, cron jobs etc. (last post here), I decided to make my own version of the Scheduler - using the observer pattern - as a learning ...
user avatar
7 votes
0 answers
253 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
5 votes
3 answers
1k views

ListBox async filtering, cancelling previous task on filter update

I'm trying to come up with a nice way of filtering a ListBox asynchronously, to keep the UI responsive. The filtering gets fired off asynchronously each time the ...
Scroog1's user avatar
  • 508
2 votes
2 answers
1k views

Promise.all, but with enforced limit on concurrent promises

I'm trying to implement parallelLimit() to limit the number of parallel tasks that can be performed at any time. Personally, I'm using this function for limiting ...
eightnoteight's user avatar
3 votes
2 answers
2k views

Using await to break long-running processes

I have a Node.js app / Web API that runs on an Azure app service with a single CPU. One of the functions needs to run for a long time, perhaps tens of seconds, while the server should continue to ...
user avatar
1 vote
2 answers
596 views

Asynchronous Queue

implemented a basic Asynchronous Queue so, that I can do await queue.push(item); const item = await queue.pop(); basically I'm trying to convert a synchronous ...
eightnoteight's user avatar
1 vote
1 answer
108 views

Asynchronous Stack

implemented a basic asynchronous stack so, that I can do. await stack.push(item); const item = await stack.pop(); basically I'm registering listeners when ever i'...
eightnoteight's user avatar
3 votes
0 answers
638 views

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

I implemented an AsyncQueue, whose dequeue() operation returns a Promise. The ...
ComFreek's user avatar
  • 751
2 votes
1 answer
5k views

Testing async method call from constructor

I have a project where I want to build a more sophisticated ToDo list - basically a personal project management system. I'm just starting out with the project, and I'd like some feedback on whether my ...
Frauke's user avatar
  • 139
1 vote
1 answer
2k views

Executing multiple async methods synchronously without throwing

I have a following task: execute multiple asynchronous methods synchronously and always execute them all, even when one of them throws. Rethrow thrown exceptions if any occured only after all tasks ...
LadislavBohm's user avatar
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
5 votes
1 answer
9k views

Injecting a DbContext with an async constructor dependency

The goal is to construct a DbContext with a connection that uses an access token. The access token is acquired with ADAL (Active Directory Authentication Library). ...
Stijn's user avatar
  • 323
1 vote
1 answer
267 views

Async database helper function in TypeScript

I have made an async function in TypeScript that responds to Events and returns an object with methods that return a promise. I ...
Rex's user avatar
  • 13
1 vote
1 answer
3k views

Async structure build (example for simple chat bot on Discord.NET)

I'm making a simple scheduler for a bot on Discord.NET and I'd appreciate some help with proper async structure of this since most of DNet is async-based. There are 2 components to this: a ...
Digika's user avatar
  • 113
0 votes
1 answer
290 views

Typewriter animation, implemented using recursive asynchronous function [closed]

In this animation, I am wondering if it's a good idea using async/await with recursive calls and the effect may be caused to the javascript event loop. Core function: ...
solimanware's user avatar
4 votes
1 answer
334 views

TypeScript based Promise/A+ compliant, awaitable promise class for Node.js

This is yet another Node.js Promise implementation, but this is written in TypeScript, and it strives for type safety and clarity. The full project is located here. Feel free to download it and test ...
Dejavu's user avatar
  • 143
6 votes
3 answers
2k views

Async method with three internal tasks

Consider we have three different database stores which we want to find an Id which is unique in all this three. I mean if we query first data store and we find that id. It's over and there is no need ...
someone's user avatar
  • 197
3 votes
1 answer
95 views

Periodically run Bash Job A to conditionally restart Bash Job B based on output of Bash Job A

Is there any neater way I can accomplish the task (as in title)? Also, I'm not sure why asyncio.Task.all_tasks() explodes and whether this is bad or not. ...
pterodragon's user avatar
2 votes
0 answers
442 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 ...
NtFreX's user avatar
  • 213
4 votes
2 answers
6k views

Pass Async function to new Promise constructor

I'm having a hard time wrapping my head around whether or not this works or how I can even test it but.... I want to use Async/Await inside a Promise, which means, when I create a new Promise, I ...
TJBlackman's user avatar
1 vote
0 answers
4k 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 ...
Mark Adel's user avatar
  • 317
1 vote
0 answers
1k 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 ...
Ste Griffiths's user avatar
3 votes
1 answer
521 views

Async Slack bot

I'm building a Slack bot to facilitate the standups for teams of developers. I want the bot to run async and not have to wait for one person's response before it starts interviewing others. Here's ...
YGilany's user avatar
  • 39
5 votes
1 answer
197 views

Verifying that tasks are really async with AsyncDetector

Running tasks asynchronously can sometimes by tricky and no matter how careful I am, I sometimes forget some crucial part and my tasks run synchronously. I don't usually notice that until it's too ...
t3chb0t's user avatar
  • 44.3k
1 vote
1 answer
120 views

Making JSON requests to fetch relationships asynchronously

I would like to refactor the fetchRelationships function to use async await. I am not sure what the best way is to do it as this code contains nested .then at ...
Szilard Magyar's user avatar

1 2 3
4
5
7