Questions tagged [async]
The async tag has no summary.
169 questions
2
votes
1
answer
68
views
Async-ifying WPF Window.Show()?
I'm working on a WPF application which has many user interactions which start with opening a non model window, allowing some interaction with the window and the rest of the application (think ...
2
votes
2
answers
245
views
Best way to add asynchronous execution for already implemented synchronous process
I have a complex process implemented in Java Spring microservice.
Currently this process is triggered on user request and it is synchronously executed.
This often results in a gateway timeout.
...
0
votes
2
answers
1k
views
C# readability - async/await or return for wrapping asynchronous functions?
Say I have an asynchronous method:
public async Task DoThing(int x)
{
// ...
}
Now, I want to wrap this method with a new method. Each of these two options are functionally equivalent:
public ...
1
vote
1
answer
148
views
golang: pattern for handling message queues? Are named functions anti-idiomatic somehow?
Had a discussion today in how to implement services that work with messages coming in from event queues. We call these services processors. One of us argues for using several functions, while the ...
8
votes
1
answer
5k
views
Should web API controller actions that perform no async work always be declared as async?
I have been going over our app web api and making sure all async work is async all the way - and no artificial asynchronicity is enforced.
Say I have the following web api controller:
[HttpGet]
...
0
votes
1
answer
619
views
How to optimize average rating calculation in a review system?
I'm thinking of a designing a review system (restaurant, hotel etc) where users can drop star reviews. Typically in a such a application, you can see the average rating of an entity along with all ...
0
votes
1
answer
336
views
Can resource which requires asynchronous cleanup be constructed synchronously?
More specifically this applies only to resources which have asynchronous dependencies themselves (but I think that's majority of them).
Concrete example:
class Foo : IAsyncDisposable
{
public ...
0
votes
3
answers
214
views
Critical section with two different "rights of way" [closed]
In C#, how do I handle critical section with two different "rights of way"?
Theoretical use case: imagine a swimming pool (the resource). Many individual swimmers (worker threads A, B, C, ...
0
votes
1
answer
143
views
Long-running jobs in an event-driven environment with constrained max-execution-duration
Hello we have an async event-driven system (kotlin, spring cloud stream, rabbitmq) where there might be an event FooPayloadArrived, published by an ingress rest-controller.
Processing this ...
0
votes
1
answer
1k
views
Asynchronous Server in C++
We are looking to develop an asynchronous server in C++. We are coming from C#, which has built-in support for async-await networking. However, with C++ it appears as if it is basically mandatory to ...
2
votes
2
answers
531
views
Should I create two synchronous or a single asynchronous rest APIs?
Here is the situation. System A sends the notification as it completes the work items to System B. System A does not know how many items the project consists of. It's just a pass-through system. ...
1
vote
3
answers
1k
views
Is it bad practice to do additional work in IAsyncEnumerable generator method?
Imagine you have to process each row in a large table.
For every single row you have to download some data from a web service and store it in a different database.
Loading all rows at once into the ...
0
votes
2
answers
479
views
Why/When do we need to call an async method from a sync method?
It is my first question here so I hope I'm not doing a mistake. I see a plethora of questions in SO that people ask "how can I call an async method from a sync method?". Given my little ...
1
vote
1
answer
373
views
C#: Should I define methods as async?
I have a C# (WPF) application which consumes a particular 3rd party API/tool (let's call this Tool A). My colleagues and I are trying to decouple that from our application, so that it is possible to ...
-2
votes
1
answer
306
views
Designing a sqlite component in C++
I work on a small component in an embedded device (sensor). This component :
Every 5 seconds, sends requests to other components using sockets
(get health check status, operating status etc) and ...
-1
votes
2
answers
676
views
Async Value Object Creation (DDD)
Suppose that I have a Value Object representing an Image URL of a Cake.
To check that it really is a cake, I make an asynchronous API call to a server that checks whether the image really represents ...
0
votes
1
answer
135
views
Organizing Parallel Arrays of Promises / Async tasks
I'm struggling a bit for a preferred way to organize a sequence of asynchronous tasks that can be applied in parallel. Say, you are parsing data from many files. In my case I'm using javascript and ...
4
votes
1
answer
2k
views
Difference Between AsyncResult and Task in c#
So, in C#, I understand the historical difference between the two vaguely; a Task is a newer concept and the highest level concurrency native C# offers.
AsyncResult is a bit more ambiguous. For ...
5
votes
1
answer
2k
views
Implementing both Sync and Async clients with DRY
I'm developing a client library. I'd like to provide both Sync and Async interfaces to endpoints on a server. They would be rather easy to implement as completely separate entities, but I would like ...
7
votes
2
answers
4k
views
How do JavaScript engines convert async/await to promises under the hood?
I'm curious how the async/await syntax is converted to Promises. Maybe I'm just not thinking about it properly, but I don't know how this code would be converted to a Promise:
async function myFunc(...
0
votes
0
answers
86
views
Streaming Promises in NodeJS
Imagine a typical HTTP service that does async db queries. If HTTP requests are received more quickly than the db can complete queries (such as because the db disk or network is slow), the Promises ...
18
votes
3
answers
39k
views
How to justify using await instead of .Result() or .Wait() in .NET Core?
Since the inception of .NET Core, console apps, function apps, ASP.NET etc. are not using synchronization context in async methods (so they're synchronizing straight to Thread Pool).
This means that ...
2
votes
2
answers
157
views
Name of locking approach
I've seen this approach several times, both in async and multithreaded code. A counter is used to track asynchronous behavior or thread behavior - whenever a new action is started, the counter is ...
7
votes
2
answers
1k
views
balance between UI responsiveness and avoiding race conditions
To keep scope small I will talk about UI race conditions initiated by the same user in the same app sessions.
The question is general and not specific to mobile, web or desktop UI.
The issue
Modern ...
13
votes
1
answer
9k
views
Is the C# async/Task construct equivalent to Java's Executor/Future?
I'm a long time Java developer, but with so little traffic on SE, I don't limit my viewing to any single tags. I've noticed that C# questions with async/await come up a lot, and as far as I've read it'...