Questions tagged [async]
The async tag has no usage guidance.
167
questions
1
vote
0
answers
130
views
How to structure your Python code with asynchronous and synchronous parts
I have a Python FastAPI server application which naturally guides you towards the asynchronous paradigm.
For legacy reasons, I have to support two backends, one which is purely synchronous and one ...
1
vote
0
answers
67
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 ...
0
votes
0
answers
53
views
Single-threaded request-response type server architecture
I'm writing an internet service in Rust that works more or less like an HTTP-server, just without the HTTP part, and strictly over UDP. I also have a requirement to build it like an old-school game of ...
0
votes
0
answers
60
views
React Design - Parent / Child Interaction with Async State
I have a situation involving a parent component, children, and async fetch operations, and I am wondering how to best structure it.
The current code structure I have is as follows:
I have a parent ...
0
votes
0
answers
47
views
Synchranization issue in async jobs created and finished before main thread ends
Main execution thread creates asynchronous job (started and executed by different process) that works on same data that the main thread. For example we create some database entries, that we want to ...
2
votes
2
answers
342
views
What are the risks in eliminating sync over async?
I'm reviewing changes to a widely used library, which are supposed to be refactorings, and so we want to minimize the risk of introducing any accidental regression. Of course, there are changes from ...
6
votes
1
answer
4k
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
171
views
Bubbling errors upstream in async message-based services
Imagine a simple set up of an API and a 2nd service, where the API pushes some msgs to the message queue and the service pulls them and processes them.
Now, if an error occurs while processing a msg, ...
0
votes
1
answer
441
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 ...
1
vote
1
answer
106
views
How should I handle routine health checks in a Node.js/Nest.js application?
I have a Nest.js application, and lately I've been thinking about how I can ensure that data is synchronized between two sources - my database and an external database.
For example - and to my ...
0
votes
1
answer
251
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 ...
45
votes
6
answers
27k
views
In JavaScript, how is awaiting the result of an async different than sync calls?
I'm having a hard time wrapping my head around the use of async/await and regular sync function calls in JavaScript.
Let's say I have two functions:
Function 1:
async function doSomething() {
...
0
votes
3
answers
188
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, ...
4
votes
1
answer
404
views
Share models between AsyncAPI and RESTful APIs?
What I try to solve:
Given I run a set of microservices, most of which expose a RESTful API and additionally publish or consume events via messaging broker,
and I have decided to go "API first&...
0
votes
1
answer
88
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 ...