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
1
vote
1answer
181 views

Change implementation from getting json from file to get it from API

I used to get a JSON file with some configuration settings from the file system, using this class: ...
1
vote
1answer
1k views

Updating sychronous code to run asynchronously using async/await

I maintain an application that has a method in a class for saving uploaded files to filesystem and I want to run asynchronously as it saves multiple files in a single request. I don't know if it's ...
1
vote
1answer
2k views

Windows Service listening for messages from a network

I am new with async task in C# 4.5 and feel insecure about this: I want to create a Windows Service that listen messages from a network (similar to msmq for example), when a message is received, do ...
1
vote
1answer
160 views

ThreadSafe IsoStorageManager

This is a continuation of the last thread. I wanted to add a thread-safety and I was considering AwaitableCriticalSection and Task+Mutex. I ended up with mutex; it can be a bit slower but it would ...
1
vote
0answers
5 views

Example Multiple Async Await Calls Javascript

I need to make an unknown number of api calls, up to 5 max probably. But most samples I've seen show only a couple of async calls so are effectively hard coded to the number of calls being made. This ...
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
15 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
102 views

Implicit Async and none async event handlers

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

Implementing Async ExecuteNonQuery() for IDBCommand vs SqlCommand.ExecuteNonQueryAsync [closed]

I'm using IDBCommand for my database layer in order to switch to other database providers than SqlDataProvider. ...
1
vote
0answers
74 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
181 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
2answers
77 views

Get an array of currency exchange prices based on asset

Function getMarkets Makes a call to get Cryptocurrency Exchange data based on asset (USD, USDC, USDT) It calls the endpoint 3 times to return 3 arrays which are then returned to the callee. I have ...
1
vote
0answers
234 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
161 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
86 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
244 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
848 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
83 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
6k views

Await on a Task constructed with an async lambda [closed]

While looking at some C# WiFi helper code, we had a discussion about this code: ...
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
1answer
1k views

Return a Promise for a JSON POST

Given this method, we don't know which syntax is the more appropriate. ...
0
votes
1answer
1k views

async/await IIFE

Would anyone be so kind to assist me if I’m ‘cooking’ async/await a right way? I attend to return an express response once promise to DB resolves. ...
0
votes
1answer
228 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 ...
0
votes
1answer
152 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: ...
0
votes
1answer
521 views

WPF async ObservableTaskQueue class

I'm currently working on a WPF application, making calls to various web APIs. Thus, I'm looking after a special observable tasks queue: Progress value must be available Tasks (API calls)/seconds must ...
0
votes
1answer
38 views

Displaying multiple objects on map and calculating distances using google api

I am quite new to Javascript. For a school project we wrote a website that displays the user's location on a google map alongside with some objects such as vehicles or passengers. I rewrote my code ...
0
votes
1answer
50 views

Enforcing C# Task to exist only once at any given point of time for a given ID

There were multiple times in different applications that I needed to accomplish the following behavior with C# Task and I did it in a certain way, and would like to ...
0
votes
1answer
46 views

Sleep and prolong sleep

What do you think about such an object function? ...
0
votes
1answer
2k views

Async task post method WebAPI controller

I have a post method in an WebAPI2 controller. I just want to make sure that everything I have done is correct. I want to create a new task run the method asynchronously and return a message. ...
0
votes
2answers
2k views

Async - await all the way

Related to this question (and even this Stack Overflow's one) I have been trying to avoid blocking the code. So what I understood it's that is preferable to make all the methods that rely on an async ...
0
votes
1answer
157 views

JW Player + Brightcove Integration

The following code gets video renditions from Brightcove using the media API. It then generates an ordered source list for the JW Player and selects the default rendition based on a pre-set bitrate. <...
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
107 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
2k views

async tcp server using async/await

Here is an async Tcp server using async/await I have written. I would be very appreciate if anyone can help to improve my code. Thank you! ...
-1
votes
1answer
42 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 ...
-1
votes
2answers
2k views

Set Label content and make it disappear after 5 seconds

Let's say I have a label and a button. If I click the button, the label is set to some text, say "hello, world!", and after 5 seconds, it should disappear. Easy enough, right? I have the following ...
-1
votes
1answer
78 views

Getting data async

I need to handle concurrent requests by waiting for the result of an already running operation. Is this code safe or does it contain bugs? ...
-1
votes
1answer
939 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 ...
-2
votes
1answer
32 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 ...
-5
votes
1answer
143 views

Optimal way to iterate between await operator calls

Is there any cleaner way to implement the following? ...