Questions tagged [async-await]

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

5
votes
2answers
141 views

Async concurrency prevention class

Because I'm quite naive regarding C#'s Task Asynchronous Programming and concurrency in general, and because it's so difficult to test, I'm concerned about the safety of this code. It's likely that ...
1
vote
0answers
9 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> ...
5
votes
1answer
170 views

Scraping an parsing jockeys data using Task.Run

I started to have HUGE doubts regarding my code and I need some advice from more experienced programmers and architects. On the button click, the application runs a method, that is running a ...
1
vote
0answers
13 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. ...
2
votes
1answer
68 views

C# Async/Await networking server

I made a simple async networking server and I'd like to get some input on the code, whether things can be done better and whether the code is stable (able to hold more than 1000 connections without ...
5
votes
0answers
48 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
3answers
264 views

Asynchronous Pattern

I have an n-tier solution which consist of DAL,BL and a ASP.net WebAPI project. I'm new with Asynchronous Pattern and I'm trying to add it to my Framework. Am I using the asynchronous pattern ...
4
votes
2answers
1k views

Wrapper for a transfer transaction API

I'm looking for any kind of advice, like when or where to do exception handling, the overall library structure/layout, usage of classes/partial classes, code efficiency, naming conventions, and so on ...
4
votes
0answers
88 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 ...
2
votes
1answer
57 views

Generic Cache-Aware Data Adapter

I've written a generic data adapter that can make use of a cache, for use in a data access layer. It presents an interface allowing CRUD operations, as well as retrieving all objects of a certain type....
5
votes
2answers
101 views

Tcp server messenger awaiter in f#

Hi I have a simple tcp server, and that server receives messages with specific length so basically i need to wait for TcpClient to fill buffer with that amount of data, and it works. But I am not ...
4
votes
0answers
52 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 ...
3
votes
2answers
118 views

Named Semaphore with async calls

I have multiple distinct processes that need to access external resources that are rate limited. The processes are all async in nature and run in different applications. In times past I would just ...
3
votes
1answer
3k 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: ...
6
votes
0answers
51 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 ...
1
vote
1answer
1k 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 ...
1
vote
0answers
85 views

Implicit Async and none async event handlers

I have implemented a event aggregator for our backend. ...
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 ...
1
vote
0answers
37 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
70 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
3answers
83 views

Class constructor with async properties set from poke-api

So, this is for a clicker game I'm trying to build with Pokémon data drawn from the PokéAPI. Since I'm using Vue.js for the project, ...
1
vote
1answer
153 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 ...
8
votes
1answer
81 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 ...
4
votes
0answers
157 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 ...
3
votes
1answer
35 views

JavaScript that deletes everything inside a folder on Box.com

I just finished a simple script for Node that will delete all the folders and files inside a specified folder ID through Box's API. It works by getting a list of items inside a folder, then generating ...
3
votes
1answer
50 views

Separating Fetch Calls and using in Promise Chain

I´m currently working on a small microservice application, which will in it´s simplest form just receive a Request from a Formular and and based on containing information perform several other Server-...
0
votes
1answer
34 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 ...
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 ...
3
votes
0answers
734 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'...
2
votes
0answers
226 views

MVVM Databinding, Commands, Async - MVVM.Light [closed]

I'm new to C#, WPF and MVVM and I don't want to make common mistakes right from the beginning and get used to them. I already read some similar questions on best practices for WPF/MVVM but none of ...
1
vote
2answers
76 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
203 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 ...
3
votes
0answers
182 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 ...
5
votes
2answers
1k 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 ...
0
votes
0answers
58 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
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
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. ...
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 ...
1
vote
0answers
134 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 ...
2
votes
1answer
58 views

Await socket Response

I wrote this to make the "callback hell" more manageable on the part of the coder when using Socket IO, so that there wasn't really any callback hell to go with, just a simple await. This should work ...
12
votes
1answer
24k views

Use of Async/Await for EventHandlers

I have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container. ...
2
votes
1answer
42 views

Chart of answered CR posts percentages over time - Part 2

I created a graph to show the change in the percentage of questions answered over time and the first version fetched data from chat transcripts using PHP. The sub-domain I have registered for my ...
0
votes
1answer
45 views

Sleep and prolong sleep

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

Executing query until there is nothing more left

I often query a database to get a batch of items to procees. I do this as long as the query returns some items. I use this pattern quite a lot so I thought I create a small helper so that I don't have ...
4
votes
1answer
25k views

Async/await in Parallel.ForEach

I have a Timer: var QueryReportTimer = new Timer(QueryReportTimerCallback, null, TimeSpan.Zero, TimeSpan.FromSeconds(15)); ...
3
votes
2answers
99 views

Streaming modified lines of a file from a Controller

I am writing a piece of software that aims at streaming the modified lines of an external file located at given uri (and retrieved as a QueryString parameter). I am trying to minimize the impact of ...
1
vote
1answer
1k views

Extension method to to run any async method synchronously

Sometimes I need to call async code from a synchronous method. This leads to repetition in code to wait for the task to complete, then ensure that the expected ...
2
votes
0answers
48 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
1answer
76 views

Simple but important function to check and retry given action's result

What I'm trying to achieve is Given a predicate function and an action which returns the object to check, check predicate, retry and fail after numTries .. or success . Purpose of this function ...
1
vote
0answers
832 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 ...