Questions tagged [async-await]
This covers the asynchronous programming model supported by various programming languages, using the async and await keywords.
337 questions
7
votes
1
answer
117
views
Proper cleanup in asyncio's __aexit__ in the case of cancellation
The following python code sample simulates an asyncio program which reads from a unix domain socket and prints its output (and additional debug output for later use)...
2
votes
1
answer
102
views
C# .NET 9 API for managing a personal investment portfolio
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 ...
1
vote
0
answers
53
views
Async Rust UdpServer with Clean-Shutdown (using Tokio)
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 ...
8
votes
2
answers
1k
views
C# wait for a state change without blocking
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 ...
5
votes
1
answer
114
views
Find food related words in German: Seeking Feedback on Concurrency and Code Organization
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 ...
5
votes
2
answers
1k
views
An AsyncStreamWriter that allows to asynchronously write to a Stream
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....
2
votes
1
answer
159
views
Simple priority task scheduler implementation
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 ...
2
votes
1
answer
229
views
Proving that a Window Message is being sent by async/await
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 ...
4
votes
1
answer
200
views
Implement DRY principle with IAsyncDisposable
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.
...
4
votes
2
answers
165
views
Idempotent JavaScript script loader
I wrote an idempotent script loader (for the browser), where the same script won't be loaded more than once.
scriptLoader.js:
...
3
votes
2
answers
2k
views
Extension methods to modify an async Task's type from Task<IEnumerable<T>> to Task<List<T>>
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 ...
0
votes
1
answer
1k
views
TCP Server using Tokio
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 ...
1
vote
1
answer
181
views
Asynchronous tasks to subscribe to orders and fills
Pretty straightforward question. The methods SubscribeToOrdersAsync and SubscribeToFillsAsync are pretty similar due to ...
2
votes
0
answers
189
views
Timer built in Unity using Async Await
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 ...
1
vote
2
answers
166
views
Scraper to grab publicly available data
I am using Python scraper code to grab publicly available data from http://XXXX.com, but it takes almost 6gb of memory and more cpu. I need to run multiple ...