Questions tagged [async]
The async tag has no summary.
166 questions
5votes
2answers
480views
How is async implemented natively?
How is async logic implemented natively without threads? What would be the high level structure of the system? Is it just a separate OS thread that gets and pushes requests and results in 2 queues? I ...
0votes
2answers
593views
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 ...
1vote
0answers
366views
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 ...
1vote
0answers
116views
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 ...
2votes
2answers
385views
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 ...
8votes
1answer
5kviews
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] ...
0votes
1answer
199views
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, ...
0votes
1answer
549views
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 ...
1vote
1answer
193views
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 ...
0votes
1answer
303views
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 ...
49votes
6answers
30kviews
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() { ...
0votes
3answers
195views
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, ...
4votes
1answer
518views
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&...
0votes
1answer
132views
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 ...
4votes
1answer
406views
Could the async keyword be eliminated in a new programming language?
This post implies that the creators of Rust had to add the "async" keyword to make the async/await functionality backward compatible. Why do we need the async keyword? In a new language, ...