Questions tagged [asynchronous]

Asynchronous programming is a strategy for deferring operations with high latency or low priority, usually in an attempt to improve performance, responsiveness, and / or composability of software. Such strategies are usually employed using some combination of event-driven programming and callbacks, and optionally making use of concurrency through coroutines and / or threads.

12,884 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
21votes
1answer
730views

Any way to change the behavior of synchronous Windows API SendARP?

I'm writing a local network scanner on Windows to find online hosts with IP Helper Functions, which is equivalent to nmap -PR but without WinPcap. I know SendARP will block and send arp request 3 ...
user avatar
  • 7,245
19votes
0answers
5kviews

Explain AsyncEventingBasicConsumer behaviour without DispatchConsumersAsync = true

I am trying out the RabbitMQ AsyncEventingBasicConsumer using the following code: static void Main(string[] args) { Console.Title = "Consumer"; var factory = new ConnectionFactory() { ...
user avatar
  • 25.9k
12votes
0answers
3kviews

XCTest: NSURLSession: Stall on main thread

When running an XCTest that executes a network operation, i get the following error: -waitForExpectationsWithTimeout: timed out but was unable to run the timeout handler because the main thread was ...
user avatar
  • 3,154
11votes
2answers
339views

Which is the most efficient way to iterate a directory?

Say I have a directory foo, with some number of subdirectories. Each of these subdirectories has between 0 and 5 files of variable length which I would like to process. My initial code looks like so: ...
user avatar
  • 14.1k
10votes
0answers
314views

wasm_bindgen Problem with async fn in Rust

So i struggle for some time because the Rust Compiler won't give me sufficient information about this Problem. I try to compile a Rust lib into a wasm module with wasm-pack build --out-dir [dir] but ...
user avatar
10votes
0answers
3kviews

How to read async server side streaming using GRPC c++

I am trying to implement asynchronous server-side streaming using C++. but I am not able to find any good example for the same. I am having a hard time reading stream asynchronously. Server Code ...
user avatar
  • 101
10votes
2answers
6kviews

Response payload is not completed using asyncio/aiohttp

I've written a Python 3.7 script that asynchronously (asyncio 3.4.3 and aiohttp 3.5.4) creates a Salesforce bulk API (v45.0) job/batch using multiple objects queried by a single SOQL statement each, ...
user avatar
  • 1,169
10votes
1answer
517views

UWP SendToAsync from Socket results in AddressFamilyNotSupported

I am using the Socket class from UWP to send data via UDP to a specific device. The problem is that after a few send forth and back, my SocketAsyncEventArgs for Sending gets stuck and in SocketError ...
user avatar
  • 623
10votes
0answers
2kviews

RouteSpecificPool timeout Occuring processing HTTP request while using NIO

We have an application in which we are making an asynchronous request to get the Servlet Response.For making asynchronous Request we are using apache nio https://hc.apache.org/httpcomponents-core-ga/...
user avatar
  • 999
10votes
3answers
307views

How can I process most jobs in parallel but serialize a subset?

We get concurrent callbacks to our web application from a vendor and we suspect it's causing us lost updates because they are processed at the same time on different machines. We need to serialize ...
user avatar
  • 12.5k
10votes
1answer
8kviews

How to wait for google geocoder.geocode?

Please, help me with google geocoder.geocode. I know that this function runs asynchronous but i do not know how to handle it. How to wait for result? Here is my code: My code do not wait for geocode....
user avatar
  • 141
10votes
3answers
968views

Latest Flutter upgrade causes error: 'DillSetterBuilder' is not a subtype of type 'SourceMemberBuilderImpl?' in type cast

Prior to upgrading, everything ran perfectly fine. This is the full error I have received post upgrade: type 'DillSetterBuilder' is not a subtype of type 'SourceMemberBuilderImpl?' in type cast #0 ...
user avatar
  • 111
9votes
0answers
285views

Will async-generators that don't have 'await' in its finally-block be immediately closed when there is no reference to it?

According to this blog, normal generators will be immediately closed when there is no reference to it. (CPython exclusive though). My question is "Does this apply to async-generators that don't ...
user avatar
9votes
1answer
4kviews

Resource temporarily unavailable when building dotnet core 3.0 dependency on ubuntu

I have a .net core 3.0 project which I'm trying to dockerise. The project file called SuperSecretProject.csproj is as follow: <?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft....
user avatar
9votes
0answers
1kviews

PhantomJS: Operation Canceled while loading resource via AJAX

This is my code: page.onResourceRequested = function (requestData, networkRequest) { console.log(requestData.url); // This message shows http://website-with-jquery-included.com/page.html! } page....
user avatar
8votes
0answers
336views

Request timeout for endpoint using StreamingResponseBody in Spring

I have a spring MVC endpoint returning StreamingResponseBody so I can stream big file instead of keeping it in memory. The request can take a while to download so it is timing out. I can fix it by ...
user avatar
  • 12.2k
8votes
0answers
2kviews

Promise.all() is slower than using await for each promise?

I'm doing some testing for performance and was looking at Promise.all() in node/js. However, after testing this it's actually slower than using await for the 3 promises I want to resolve. I'm simply ...
user avatar
8votes
0answers
255views

How to use PreferenceDataStore in async mode?

I would like to store user preferences in Firebase real time database instead of typical sharedPreferences. As an example, my user should specify the itemId in order to access to this part of the ...
user avatar
  • 415
8votes
0answers
432views

webpack intercept/hook into async importing

Webpack provides a number of ways to asynchronously load modules (require([], resolve), import('...'), require.ensure). Using those functions makes webpack to automatically split resulting bundle into ...
user avatar
  • 1,215
8votes
1answer
2kviews

Spring DeferredResult onCompletion not called from test cases

I have a comet(long polling) Controller call, which takes in some ids and puts then into a blocking queue if no calculation for that id is running, for a Consumer to take from the queue and perform ...
user avatar
  • 1,014
8votes
0answers
2kviews

How to load vendor and app JS in async scripts with webpack?

I'm interested in splitting my initial code in two chunks which are loaded asynchronously by the application using async/defer attributes. One for vendored libraries which rarely change and are big so ...
user avatar
  • 1,680
8votes
1answer
1kviews

Spark Async interface for Fold, Reduce, Aggregate?

In the official Spark RDD API: https://spark.apache.org/docs/2.1.0/api/java/org/apache/spark/rdd/AsyncRDDActions.html count, collect, foreach, and take all have async variants that return a Future. ...
user avatar
  • 15.2k
7votes
0answers
2kviews

How to pause Jupyter Notebook widgets, waiting for user input

In my notebook I've a loop in which I want to ask the user to binary "Yes" or "No". On this choice the algorithm is suppposed to continue. for i in range(n_total): display.clear_output(wait=True) ...
user avatar
7votes
0answers
1kviews

integrating django with aiohttp/asyncio

I want to integate django with aiohttp/asyncio for asynchronous programming and for websockets handling. I know django has celery & django-channels to do asynchronous task and websocket server ...
user avatar
  • 509
7votes
1answer
2kviews

PowerShell: How 'Receive-Job' pulls output from the job's code block in detail?

Please have a look at this test script and the conclusions I've made about how 'Receive-Job' works in detail. I have still issues to figure out, how exaclty 'Receive-Job' pulls the streams from the ...
user avatar
  • 291
7votes
0answers
5kviews

How to debug async functions using Chrome?

Take a look at the following code async function example () { const a = await resolveAfter2Secs(20); const b = await resolveAfter4Secs(30); return a + b; } Is there a recommended standard way ...
user avatar
  • 1,624
7votes
2answers
1kviews

FullCalendar view freeze after viewRender

I'm having quite an issue here, I'm trying to load event while changing view using a sync point. Changing the sync point works great, I can also send and receiver the informations. But the calendar ...
user avatar
  • 7,789
7votes
0answers
468views

Asynchronous C callbacks into Haskell code via FFI

I'm currently trying to port parts of the Windows API to Haskell. One of the functions covered is SetConsoleCtrlHandler which registers a handler callback that is called whenever a Ctrl+C or Ctrl+...
user avatar
  • 2,898
7votes
0answers
675views

What is the proper way of cleaning up asynchronous requests before servlet redeploy (Jersey, Tomcat)?

I have an asynchronous JAX-RS API for long-polling clients put together in Jersey Container Servlet 2.22 and hosted on Tomcat 7. It looks similar to the snippet shown below. It works well in ...
user avatar
7votes
1answer
277views

Node js + multiple nested inner functions with callback

I have nested inner functions with callback that are with in the single function(abcd). I need to call abcd function from outside using async and return the response. var listFunctions = { test1 ...
user avatar
  • 1,748
7votes
0answers
2kviews

focus() method and event order (in pure JavaScript)

I am currently working on a large web project with a sophisticated help system and therefore need an in-depth understanding of when events are fired synchronously or asynchronously, respectively. ...
user avatar
  • 3,128
7votes
1answer
2kviews

Express Formidable upload - check file extension, move and delete

I am working on a file upload form with Express 4 and Formidable and have some problems. What I'm trying to achieve is: -Check if file is selected and extension/format before file is uploaded to the ...
user avatar
7votes
0answers
699views

Real-life use cases of scala-async?

Today I looked into implementing something really basic using scala-async, namely, a retry loop for a function that might fail. Firstly, I couldn't use await() in a try/catch block; well fine, that ...
user avatar
  • 34.8k
7votes
1answer
1kviews

Measuring C# / Async Data Access Using StopWatch Class

I have the following code and it seems the Elapsed Milliseconds are inaccurate: public async Task<ActionResult> Index() { try { var connString = ...
user avatar
  • 549
7votes
1answer
1kviews

gevent.http.HTTPServer API suggests streaming, but instead buffers entire requests and responses

The APIs offered by gevent.http.HTTPServer would seem to support streaming in both directions. The request object does not offer the request body as a simple string, but instead provides an ....
user avatar
7votes
2answers
600views

how to exhaust ASP.NET worker threads to show importance of async await pattern

I am trying to demonstrate to a junior the importance of asynchronous programming, using async and await. For the purpose I have created an ASP.NET Web API project with one controller and two GET ...
user avatar
  • 1,545
7votes
1answer
1kviews

Async API using Spring + Jersey

I am working on building API that could potentially have a high number of requests per second, and some of the requests may require a lot of computation (complex reports). I've been asked to put ...
user avatar
  • 5,928
6votes
1answer
199views

Combine asynchronous iterables, via native promises

I got stuck, trying to implement combine logic for a list of mixed iterables, i.e. I have a list of Iterable + Iterator + AsyncIterable + AsyncIterator, for which I'm trying to combine them together, ...
user avatar
  • 21.9k
6votes
0answers
2kviews

React Testing Library: waitFor vs act

I have an async method that changes the state by callback: class Demo{ callback: () => void; async triggerCallback() { this.callback(); } } This callback is being used to hide/show ...
user avatar
  • 191
6votes
0answers
780views

Flutter upload in background for iOS and Android

How to upload images to Firebase Storage in the background that means upload continues even the app gets closed?
user avatar
6votes
0answers
1kviews

Debugging an async program in the pycharm debugger

My request is to get debugging data from the debugger and pycharm prompt: Lets say I have an-old-style python synchronous program with a bug: def listdir(self, remote_path): with ssh....
user avatar
6votes
0answers
2kviews

Jest doesn't wait for async beforeAll to finish

Im trying to test getting all users from my REST API. describe('GET', () => { let userId; // Setup create the mock user beforeAll(async () => { //Create the user return ...
user avatar
6votes
0answers
4kviews

Python multiplayer game with websockets: Handling multiple clients

I'm trying to build a multiplayer game (to be precise a Card game) in Python via websockets, but I'm currently failing in the very early steps. What I'm trying to do: Clients connect to the ...
user avatar
  • 311
6votes
0answers
4kviews

Unit test code inside of CompletableFuture runAsync

There is a code written by someone who had called completable future to do an activity that is a call and forget i.e. output is not looked after (no get() call). CompletableFuture.runAsync(() -> {...
user avatar
  • 146
6votes
0answers
2kviews

Unit Test for Spring Asyncronous post request is returning exception(async started expected as true but false)

My POST request is Asynchronous because I am using spring-data-rest. Now I am having issue when trying to write a test case for the POST request. The exception is "Async started expected: true but was:...
user avatar
  • 131
6votes
0answers
3kviews

Why is (Dapper) async IO extremely slow?

I'm using load-tests to analyze the "ball park" performance of Dapper accessing SQL Server. My laptop is simultaneously the load-generator and the test target. My laptop has 2 cores, 16GB RAM, and ...
user avatar
  • 27.4k
6votes
0answers
571views

vert.x There is a query still being run here - race -> false issue for SQLConnection

I am using vert.x SQLConnection for database connection. where I am running simple query in loop using same connection. Following is my code sample public static void test(RoutingContext ...
user avatar
  • 1,373
6votes
0answers
3kviews

Threading/Async in Requests-html

I have a large number of links I need to scrape from a website. I have ~70 base links and from them over 700 links that need to be scraped from those starting 70. So in order to speed up this process, ...
user avatar
6votes
0answers
708views

Generic Python Error "MemoryError"

I have a Python program that runs in several processes, and I periodically get the following error message that I can't resolve...or even really tie down to a specific section of code. Any ...
user avatar
6votes
1answer
257views

Google Tag Manager with Comodo SSL Trusted Site Seal

I'm currently in the process making Google Tag Manager handle all our JavaScripts due to several benefits which I'm sure you all know to well. Everything is going to plan apart from one problem which ...
user avatar
  • 3,014

15 30 50 per page
1
2 3 4 5
258