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
2 votes
1 answer
80 views

I've written a C# API using .NET 9 with the goal of managing a personal investment portfolio – that means, adding funds adding or removing transactions (for ETFs, ETCs, and usual funds) retrieving ...
Daniel's user avatar
  • 353
1 vote
0 answers
50 views

I'm new to Rust and trying to build an async Server. The server should receive UDP packets, process them (which will include more network communication), and respond the result to the client. I had ...
x539's user avatar
  • 201
8 votes
2 answers
1k views

I have a class that manages an HttpClient to make API requests to a third party service. The service requires being logged in to make requests. When logged in, a ...
yasar's user avatar
  • 1,597
5 votes
1 answer
104 views

I'm developing a pipeline that processes unknown ingredient data from the OpenFoodFacts API. The goal is to find valid German words that are not yet in their taxonomy. The tool performs the following ...
kiaora's user avatar
  • 141
5 votes
2 answers
994 views

I'm hoping this should be mostly asynchronous, looking to make this close to 100%, if not 100%, so. This class was created to ease converting image formats, but it has an unlimited number of use cases....
Short Int's user avatar
  • 762
2 votes
1 answer
157 views

My project I am working on requires the following functionality for the processed messages: each message has a priority messages with higher priorities should have precedence over the ones with lower ...
Alexei's user avatar
  • 1,796
2 votes
1 answer
215 views

I asked a question on Stack Overflow and there's a discussion between @Serg, who posted an answer and @Jimi, whose comments suggest that the answer might be wrong. So I implemented the following code ...
Thomas Weller's user avatar
4 votes
1 answer
192 views

This is a tiny class that creates backup copies of a file so these can be diff'ed to spot the changes compared to last run; used when generating code and so far has proved to be very helpful. ...
aybe's user avatar
  • 612
4 votes
2 answers
160 views

I wrote an idempotent script loader (for the browser), where the same script won't be loaded more than once. scriptLoader.js: ...
lonix's user avatar
  • 153
3 votes
2 answers
2k views

I've written a lot of (await SomeTask).AsList(); in my project, and it's kind of annoying to keep wrapping it. To fix this I've written a little extension method on ...
Joost00719's user avatar
0 votes
1 answer
1k views

Solving the following problem on Protohackers: https://protohackers.com/problem/1 The problem: Each request is a single line containing a JSON object, terminated by a newline character ('\n', or ...
Rish's user avatar
  • 2,486
1 vote
1 answer
180 views

Pretty straightforward question. The methods SubscribeToOrdersAsync and SubscribeToFillsAsync are pretty similar due to ...
nop's user avatar
  • 819
2 votes
0 answers
188 views

For learning purposes, I built a timer that does something every x seconds in Unity using an async Task instead of a coroutine. I'd like to know if there is a less awkward way of writing this: What ...
willywinelover's user avatar
1 vote
2 answers
141 views

I am using Python scraper code to grab publicly available data from http://103.48.16.132/echalan/, but it takes almost 6gb of memory and more cpu. I need to run ...
Learner's user avatar
  • 119
2 votes
1 answer
137 views

I am building a basic authentication system with a node backend and wonder whether I am using the try-catch block excessively. I have this example controller: ...
user8758206's user avatar
3 votes
0 answers
681 views

One of the companies I was recently interviewing with gave me a following task to implement in a day or two using .Net, just to see where my coding abilities are at: Implement a Web API that gets ...
mi105's user avatar
  • 31
0 votes
1 answer
641 views

I have a method that takes a collection of objects, and in turn calls a method that handles a single object. My question is, do I need to handle the tasks coming from the ...
Russ's user avatar
  • 133
1 vote
1 answer
3k views

I want to process a file chunk by chunk to prevent memory exhaustion. I need to consume the file using a read stream. When trying it, this implementation seems to work fine. I am asking your expert ...
Louis Coulet's user avatar
0 votes
1 answer
401 views

The code below is my first purpose built asynchronous recursive function. It took me a while to figure out how to write the thing, and I would like a second opinion. It's part of a project for The ...
ablueblaze's user avatar
0 votes
1 answer
164 views

I have a method that iterate over my table question in database and then will split a column commentaires and finnally put ...
Coder95's user avatar
  • 143
3 votes
0 answers
8k views

I'm having an implementation using SerialPort in C# using Visual Studio 2019. I'm using it in a Windows Application, using .NET Framework 4.7.2. When I open and ...
Hans Billiet's user avatar
3 votes
2 answers
4k views

Often I have async functions that I want to be able to time out, this timeout is independent of the greater scope of the application. However the function should also take into consideration the ...
Adriaan's user avatar
  • 55
2 votes
1 answer
313 views

I have a sequence, retrieve data from a vendor API, cleanup our stage tables, and write the retrieve data into the database. What I have: ...
Greg's user avatar
  • 549
3 votes
0 answers
114 views

Here's a small experiment about handling boilerplate tasks via service pipelines. It's similar to the HTML pipeline but simpler and multipurpose. I've updated the question and this is the 2nd version ...
t3chb0t's user avatar
  • 44.7k
6 votes
1 answer
3k views

Here is my effort to implement extensions for FileInfo object: ...
SeReGa's user avatar
  • 161
1 vote
2 answers
1k views

I wrote a method that lets me retry RestSharp requests when a specific exception is thrown. Here's the code for that method: ...
Erick Santander's user avatar
1 vote
1 answer
365 views

Given the code: async getData() { const response = await handleRequest(…); return response; } Many of static code analyzers mark this code with an issue ...
Mike's user avatar
  • 277
3 votes
2 answers
601 views

Overview I've created an asynchronous and recursive method of generating word squares, of any size (known as the order of the square), from a known word list. If you're unfamiliar with word squares: ...
Taco's user avatar
  • 929
1 vote
0 answers
161 views

Recently, I had to write a code to classify and rename lots of image files based on their content. So, I wrote a Python script which displays all those images as a slideshow to the me, and I can ...
Sourav Kannantha B's user avatar
3 votes
1 answer
585 views

The original purpose of this script was saving data to a local file, which is still the primary purpose. Since I may only obtain one copy of a data stream (not this particular Coinbase one; it's just ...
davidtgq's user avatar
  • 131
0 votes
1 answer
925 views

This is a class that allows only limited number of requests to proceed per period of time. This is designed for use with external APIs that require such rate limiting, e.g. 600 requests per 10 minutes....
Bob's user avatar
  • 587
3 votes
0 answers
101 views

I'm trying to separate the fetch logic from the component, but, due to the nature of async/await functions I have to write an async function to call other async function and I wanted to know if that's ...
Ton's user avatar
  • 31
3 votes
1 answer
870 views

I have a Send method that is working but want to refactor a portion where it is using PostAsync().Result and ReadAsStringAsync().Result. I've never written async methods before and don't feel I ...
CodenameCain's user avatar
11 votes
3 answers
784 views

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

I'm wrote Asynchronous Lock provider for reducing lock that breaks async keyword. All tasks with async and ...
jay k's user avatar
  • 85
1 vote
1 answer
5k views

This class acts as an asynchronous event handler that will execute all attached tasks in an async/await context. Requires Nuget Immutables. Example usage: ...
FatalSleep's user avatar
2 votes
0 answers
1k views

I wrote this ~100 line script recently, where I tried out Python's asyncio library. When it comes to asynchronous programming in Python, I just have 2 days of ...
Vikas Prasad's user avatar
4 votes
1 answer
262 views

I know this has been done many times before, but this is my existing code taken from a sample I found to async process a list of tasks. I've seen Task.Run in use before in many examples, but I'm ...
user183872's user avatar
1 vote
2 answers
609 views

The ideas are When multiple async calls are made, to be able to start consuming from the first resolving one regardless in what order the promises are fired. To construct a modern emitter of async ...
Redu's user avatar
  • 946
3 votes
3 answers
1k views

Example of use: var users = await usernames.SelectTaskResults(GetUserDetails, 4); where GetUserDetails(string username) is a ...
Paul Totzke's user avatar
3 votes
2 answers
816 views

I wrote a simple function for retrying the passed function in case it throws. I did it for my app that needs to call an external API through the network, which may spuriously fail. ...
Louis Coulet's user avatar
1 vote
1 answer
1k views

To better familiarize with async requests I wrote a very simple scraper that relies on aiohttp to retrieve some basic information from the product page (product ...
anddt's user avatar
  • 195
1 vote
0 answers
566 views

I am new to asynchronous programming in python. Below are two scripts(which perform the same operation) one in Fastapi + aiohttp while other is basic Flask + requests library: ...
Charlie Chap's user avatar
-1 votes
1 answer
872 views

I need to call some synchronization function and need they running in background and canbe canceled. So I write this: ...
Mr. Squirrel.Downy's user avatar
0 votes
1 answer
448 views

So, I am using Repository pattern with Dapper and ADO.NET. I have my based DB infrastructure setup as follows: ...
Rahul Sharma's user avatar
1 vote
1 answer
88 views

I Have the below code that gets urls of PDF files, send them to a convert function and returns them as images, is there a way to make this code more readable? Is there a way to avoid functions ...
user3378165's user avatar
3 votes
1 answer
838 views

This currently runs with 1400+ sockets and manages data correctly and in the manner the application requires. I do have an issue with the HandleData method where ...
Adam H's user avatar
  • 161
4 votes
1 answer
198 views

My express.js application uses a lot of promises for interacting with a variety of services. Instead of including try/catch with each one, I've setup a fail safe factory method for all my express ...
Josh's user avatar
  • 143
2 votes
1 answer
164 views

I have an interface, implemented by a service, that I inject here and there in my codebase. I would like to give the opportunity to use either the normal method or its async equivalent. ...
Arthur Attout's user avatar
8 votes
3 answers
4k views

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

1
2 3 4 5
7