Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

1
vote
2answers
78 views

Better to block on async with HttpClient than use synchronous API like WebRequest?

I have been a staunch advocate of never blocking on async code. I felt it was always better to use a synchronous API than to run the less efficient state machine generated by the compiler even if ...
0
votes
1answer
80 views

Best approach for web service that calls other web services

The scenario is: client makes request to server A Server A makes potentially multiple requests to server B. Edit to clarify, server A makes the requests concurrently using Futures. Server A blocks ...
1
vote
4answers
188 views

Problem with async/await pattern — in C# and JavaScript — how to return sync value

In old-style await'less NodeJS, when you call a function that had an asynchronous aspect, you'd pass in the well-known callback which gets called when the asynchronous portion is done. This didn't ...
1
vote
1answer
77 views

sequential command processing with an async io cloud upsert

We are new to c# and still trying to grok the async idioms. We have a windows service that requires us to iterate a list of results queried from a PC database to feed the parse cloud server (which ...
1
vote
1answer
62 views

Design: HTTP and Websockets working together

I'm at a bit of crossroads here and I wanted to ask the opinion of the community. I am creating a chat application for our company. Now, like every chat application out there, the messages are saved ...
0
votes
1answer
83 views

How to statically check you didn't forget to await for an async function

A common bug in JavaScript is to forget the await keyword when calling an async function. Of course you don't always want to await, sometimes you really want to get a promise. And of course you can't ...
-2
votes
1answer
659 views

Check is finish async and await behavior

I am trying to understand the async and await.Now i want to apply async and await keyword in my current project.My process structure are: //DataAccess Private List<Users> GetAllUsers() { ......
0
votes
0answers
295 views

Multiple API calls potentially spawning multiple Websockets - Threading vs Async

I am designing a program with the flow as outlined below. Note, these are all network calls, there is no system I/O (hard drive). Initially, multiple independent API calls need to happen - they don'...
5
votes
1answer
160 views

Immediately awaiting an asynchronous call [duplicate]

While working on an inherited project, I noticed the original dev(s) created many asynchronous functions that never seem to take advantage of being, well, asynchronous. For example: // The async ...
3
votes
1answer
269 views

How can I reduce bloat in my callback based serial communication?

I'm communicating with a device that's connected to the computer via com port. The device accepts certain predefined commands in order to interact with it. I'm essentially creating a more abstract API ...
0
votes
0answers
126 views

How to design an async mechanism for performing long-running tasks in a workflow

I'm designing a workflow engine (that runs as a service) for executing arbitrarily defined workflows consisting of arbitrarily defined tasks. There will be a queue. An instance of the service will ...
1
vote
0answers
121 views

Proper code structure for a Servlet using caching and async

I'm using an Java Servlet (with embedded Jetty, no Spring, no frameworks) and I'm adding asynchronous processing and caching to it. The exact implementation is irrelevant to this question and it's not ...
0
votes
0answers
36 views

What are some efficient mechanisms to notify users asynchronously

Eg - A bank sends thousands of SMSs to its customers using a service. How does this service notify the bank of the status of the SMSs asynchronously whether delivered/failed/pending
4
votes
2answers
625 views

Correct way to implement non blocking async methods in .net?

I've made the code below work and it is mostly non-blocking except where the process.start code is. However, my question is, in my winforms application is this the best way to implement the use of ...
1
vote
2answers
592 views

JS: convention to distinguish immediate vs async methods

I normally have a laissez faire attitude on method naming conventions but now I am working on a module in JavaScript that will have some methods that can return the value directly (immediate / plain ...
1
vote
1answer
1k views

Creating a (System.Threading.Tasks.)Task scheduler

I'm working on rearchitecting a game engine in which multiple concurrent scripts run in parallel threads, which unfortunately occasionally gives rise to race conditions. I'm trying to set it up so ...
1
vote
1answer
9k views

Correct usage of async/await and Task.Run()

I am developing an application that will read excel files from disk and then process tests based on the data in the files. In order to keep the user interface from locking up when loading files and ...
1
vote
0answers
193 views

Why are most ReactiveX implementations push-based?

Feel free to correct my history, but as far as I understand it, Rx and the Reactive Manifesto trace their roots back to C# and its Reactive Extensions, which is uses push (callback-based) messaging, ...
1
vote
1answer
214 views

Pattern for subclass overload with different arguments

I'm in the process of writing an bidirectional, asynchronous socket server and server handler. The base handler class I'm working off of is as follows: class BaseAsyncSocketHandler: async def ...
3
votes
1answer
584 views

Task Parallel Library Console Application Design - How do I lock a thread to a specific context?

I'm currently developing an application which relies on multiple sockets listening for chat messages. When the messages come in, they're passed off to a bot that's associated with their channels. ...
8
votes
2answers
4k views

What exactly happens when a thread awaits a task inside a while loop?

After dealing with C#'s async/await pattern for a while now, I suddenly came to realization that I don't really know how to explain what happens in the following code: async void MyThread() { ...
12
votes
3answers
13k views

Calling multiple async services in parallel

I have few async REST services which are not dependent on each other. That is while "awaiting" a response from Service1, I can call Service2, Service3 and so on. For example, refer below code: var ...
0
votes
1answer
1k views

Executing a periodic Task with std::async

I am writing a class which periodically has to check, if the data it manages is too old, if so it should delete it. I am new to the C++11 multithreading library and I have the following questions: ...
1
vote
1answer
1k views

Does omitting await keyword once in the call stack break the asynchronous behavior of the whole stack?

Call stack may contain several methods returning Task. If all of them are decorated with async, the flow of execution is quite simple. However, what if one of them is not awaited - are other method ...
2
votes
3answers
1k views

How to avoid pollution of logic with lazy-loaded async properties

To be able to scale I would like to use async programming. It works really well if I have to read something from db and push to frontend, however I do not know how to use it correctly in blobs of ...
15
votes
5answers
6k views

Why would you ever 'await' a method, and then immediately interrogate its return value?

In this MSDN article, the following example code is provided (slightly edited for brevity): public async Task<ActionResult> Details(int? id) { if (id == null) { return new ...
1
vote
2answers
431 views

Why are Promises not “awaited” by default?

In the latest version of languages like TypeScript or ECMAScript you can use async/await constructs to write code that combines the clean structure of synchronous programming with the performance ...
3
votes
1answer
196 views

async methods: are there any concurrency issues the programmer must address

Let's say this getPhotoAsync method can be invoked a few times a second, and that the responses from the remote server can take anywhere from half a second to thirty seconds, depending on the size of ...
0
votes
1answer
183 views

Async web server and associated 'workers' implementation

In a regular WSGI service provider implementation there is a blocking HTTP server that services clients. When a client, for example, creates an invoice, the server simply makes a CRUD operation that ...
1
vote
1answer
262 views

Need Async/Await equivalent for BackgroundWorker

Given the following code in the DoWork() event of a BackgroundWorker object, how can the concept be converted to the Async/Await model? I wish to execute multiple downloads simultaneously in order to ...
1
vote
1answer
3k views

What are the benefits of Asynchronous HTTP

Q.1 I know that when we are talking about synchronous HTTP, for each request a Thread may be spawn and get blocked, so when number of simultaneous connections increase, we will encounter massive ...
4
votes
1answer
138 views

How do async action methods maintain their network connnection?

In ASP.Net MVC, the classic (synchronous) way to write an action method is to return ActionResult. More recently, the ability to perform action methods asynchronously was added, by allowing action ...
1
vote
0answers
66 views

Downloading information, but just when needed

I'm struggling with thinking of how to implement the following (in java): I try to create a program, that displays information about lots of tv series. For this i use the website "Burning Series" (...
14
votes
2answers
3k views

Why does C# allow you to make an override async?

In C#, when you override a method, it is permitted to make the override async when the original method was not. This seems like poor form. The example that brought me to this was this — I was ...
2
votes
1answer
138 views

Remote job execution and synchronization

I have master and nodes infrastructure. Master executes remote jobs on nodes. Each job returns success/failure message back to master. So the flow of execution is the following: master receives ...
1
vote
1answer
61 views

How to find the cause of an exception in async code

I often see myself trying to follow my own code to find out where the exception came from. The typical example is when some parsing fails, and I catch the execption. Then I spend a ridiculous amount ...
3
votes
1answer
292 views

Asynchronous socket.io for lots of concurrent messages

We have a web application which currently operates like this on a typical view/page: the front has to display 100+ "previews" (in the form of base64 images) each of this preview is built on-demand by ...
0
votes
1answer
820 views

Handling multiple asynchronous events - Wait for pending offers to process on new offer?

I have a programming problem, that I don't know how to solve. And while I have provided a sample of my code, I am interested in a conceptual answer on how to resolve this problem. On a tradeOffers ...
1
vote
1answer
762 views

HTTP Async/Await Task: avoid flooding server with requests?

I have a scenario where I have a Windows Store Application, there is a page with a search functionality, the user types names in a textbox and the app searches for names similar to the typed text. ...
0
votes
1answer
417 views

Is the logic behind `Asyncio.wait()` and async/await, the same, just the code is written differently (syntax)?

I'm learning Python, more specially parallel programming using Python Parallel Programming Cookbook by Giancarlo Zaccone. At the time the book was published async/await was still in the beta version ...
2
votes
0answers
201 views

What is the “async desaster” Detlef Vollmann was talking about at Meeting C++ 2014?

I found the slides of his talk there: https://meetingcpp.com/tl_files/2014/talks/executors-meetingcpp.pdf In one of the last pages, he is talking about the "async desaster" (which I, as a non-native ...
21
votes
3answers
5k views

How can I diagnose async/await deadlocks?

I am working with a new codebase that makes heavy use of async/await. Most of the people on my team are also fairly new to async/await. We generally tend to hold to Best Practices as Specified by ...
1
vote
0answers
800 views

Enforce No Multiple Async Entity Framework Operations

We are working on a large-ish MVC web application with multiple backing stores including a SQL Server database accessed via Entity Framework 6.0. We are using asynchronous operations wherever we can, ...
2
votes
2answers
942 views

Await state async

For speed we sometimes return response to consumer before state is saved in DB. Sometimes (Mostly for our automated consumers) this can break because the want to make actions on the saved data before ...
6
votes
2answers
5k views

Too many REST API calls on a page?

A web app designed with highly modular, small components (in this case using AngularJS directives but could just as easily be WebComponents, ReactJS components, or any other technology). Components ...
11
votes
2answers
503 views

Readiness vs. Completion Async IO Memory usage?

I was watching this talk about implementing Async IO in Rust and Carl mentions two potential models. Readiness and Completion. Readiness Model: you tell the kernel you want to read from a socket do ...
4
votes
1answer
1k views

C# async/await: Pedantry vs. the Debugger

I'm playing around with async and await, and they seem pretty intuitive, but some of the things I'm reading about these keywords doesn't make sense to me. In fact, some of it seems to me to be flat-...
1
vote
1answer
164 views

Is async keyword an ultimate replacement for asyncio module?

Recently, there was a rise of interest toward asynchronous programming in Python community. First prominent expression of this interest was the appearance of Asyncio —codenamed Tulip— framework [PEP ...
3
votes
1answer
144 views

Connection between futures and exceptions?

Is there a connection between futures and exceptions? async-await looks very similar to throw-catch.
3
votes
2answers
504 views

Async library guidance

I'm creating a library that contains a class that exposes several Async methods: public class MyClass { public async Task<Foo> DoFooAsync() { /*...*/ } public async Task<Bar> ...