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.

0
votes
1answer
17 views

Does this work as a way to initiate background work that I can cancel without caring about the result?

I'm working on a C# tool to simulate an ongoing workload on a database while a certain sequence of queries/stored procedures runs, in order to gauge the performance of those queries/stored procs. What ...
0
votes
0answers
16 views

Data streaming between two points using armeria/netty interrupts

I have an app which based on a path received it should stream a file between openstack-swift and s3. Currently i'm using the framework Armeria which is based on netty The transfer gets interrupted ...
-1
votes
1answer
38 views

How to wait for on a Task Completion Asynchronously

I am writing a piece of code that triggers multiple tasks, and at the end I need to wait on a task to finish to move ahead. Sample Code -- var taskToWaitOn = Task.Factory.StartNew(Method1); Task....
0
votes
1answer
8 views

Test code inside Runnable run asynchronous method JUnit

There is ClassA (to test JUnit) and ClassB. Goal is to test code inside run method inside doSomething method(in ClassA). And run method should be executed instantly and not in background/new thread. I ...
0
votes
0answers
12 views

How do you (or can you) run asynchronous code in JOVO's Intents?

I want to run an asynchronous function inside of my JOVO's intent. At the moment, it's running the code synchronously, which doesn't allow the JOVO to send the correct response. This is what my code ...
0
votes
0answers
15 views

Getting line number during test in jest/node (during async calls)

For my own personal reasons, I'd like to know which line is currently being processed when running a jest (or node) process. My attempts so far have revolved around throw new Error().stack, but that ...
0
votes
1answer
22 views

How to execute all the functions in a loop, where some functions are needed to be called as a callback of async function

I have a javascript Object which has a mix of async and sync function, I am using lodash map to execute all the functions of that object. Below is my code where, args.actions contains mix of async/...
0
votes
1answer
74 views

How to find out which Task has finished

I have an async code to upload all files in a directory to an API. It works fine but I would like to track which file has uploaded and would want to log, so that I can do some status check. I have ...
0
votes
0answers
26 views

Asynch into Synch

The Following has top happen : 1)how do you effectively wait for that answer to come back? How do you wait? 2)How do you have a timeout for when that 3rd party takes longer than, say, 10 seconds ...
0
votes
1answer
18 views

Unity - “Dynamic” Object pooling

I'm making a small game for android and currently use a pooling system e.g. for enemies, projectiles etc. As for now I'm Async loading in levels as you play the game which means no loading scene when ...
0
votes
0answers
18 views

How to make asynchronous program output sequentially?

I use a python library(aiohttp) to get the response form post request. Can I get sequential result? How to...? import aiohttp import asyncio import base64 import json from tqdm import tqdm import ...
0
votes
2answers
24 views

How to fix node.js returning {} when using async with mongoDB

I'm trying to get node.js to return information from a mongoDB database when called. In my database, I have _id: ObjectID("5cc0fe18f7875c00bc88de4c") url:"google.com?ref_source=test" count:0 ...
0
votes
1answer
15 views

Does async* lazily invokes the function?

I faced an interesting problem during writing some unit-tests for my project. Here is a map which user can use to place markers: class DomainMap { static const _DEFAULT_COORDINATE = const ...
0
votes
1answer
18 views

await message.awaitReaction with an async filter isn't awaited

Why is my console logging "Finished" before "Started" ? Why can't I await message.awaitReactions(); ? const filter = async /*It is here for no reason but without it does not work neither*/ (reaction, ...
0
votes
0answers
18 views

Java's CompletableFuture - send multiple requests, wait for first valid response

Consider the following scenario: A Java application is communicating with multiple tabs of a single browser. It is capable of sending JS requests to each tab, and as a result, a CompletableFuture<...
0
votes
1answer
28 views

Tell forEach to wait, but mostly avoid wrapping everything inside an async function to use await

so I got the problem, here is the code const resultsArray = []; function parseDoc(doc) { const docStringified = JSON.stringify(doc); console.log(docStringified); docObject = JSON.parse(...
1
vote
1answer
13 views

Add new function in promise.all runtime in node

I am not sure about this question if this can be implemented or not. I am using node.js with express.js and MySQL database. I have a few records in MySQL database. These records are updating ...
1
vote
1answer
54 views

Wrapping IO-bound asynchronous methods in Task.Run

The following is quoted from Using the Built-in Task-based Combinators section. public async void button1_Click(object sender, EventArgs e) { pictureBox1.Image = await Task.Run(async() => {...
0
votes
1answer
53 views

Any advice on how to tune parameters to download urls faster with less errors? (trio + asks)

I'am writing simple program that downloads list of urls. prepare list of urls !curl -LO https://github.com/mozilla/cipherscan/raw/master/top1m/top-1m.csv !head -5 top-1m.csv 1,google.com 2,...
0
votes
3answers
74 views

Is it possible to get successful results from a Task.WhenAll when one of the tasks fails?

Given the following: var tPass1 = Task.FromResult(1); var tFail1 = Task.FromException<int>(new ArgumentException("fail1")); var tFail2 = Task.FromException<int>(new ArgumentException("...
0
votes
1answer
7 views

Preloading assets in React-Native expo app never finishes

I'm writing a simple app with React Native and Expo. This app has ~10 small to medium sized images that are used in different places within the app. From what I read, unless I cache these images, ...
1
vote
2answers
48 views

Second cached video being used for all cells?

I attempted the following caching mechanism to cache videos which are added in cells in my app: import Foundation public enum Result<T> { case success(T) case failure(NSError) }...
0
votes
1answer
22 views

How can I make non blocking API requests in Laravel

I created a simple API in Laravel where a user can uplaod an image via POST. In my Controller I save the Image and then I want to send it to an external API to get it classified. This API call ...
0
votes
3answers
26 views

Creating a Timestamped Object Array for Sampling Data in Javascript?

Goal is to push sampled data, as an object, onto an array, at a periodic interval and wait to log the new array out to the console once it is finalized. I'm new to JS, so take it easy ;). I am ...
0
votes
1answer
42 views

Wait for async function

I'm aware this is a common problem asked by developers but I can't seem to find anyone who has the same issue as me. I've got a game i'm creating, this game has lots of factories that when called ...
3
votes
1answer
49 views

Is `java.nio.file.Files.createFile` a blocking call?

Does java.nio.file.Files.createFile block calling thread? If yes, what is a non blocking async alternative to create a file/directory? I am looking for a simple solution that can work in java or ...
1
vote
2answers
35 views

Is there any problem with using async function as an EventEmitter listener?

I am writing a Node.js v10 app and I'd like to use await in an event listener function, so I've made an async listener function. Based on the code below it seems to work. But I am curious if there is ...
-1
votes
0answers
86 views

Returning awaited calls in a tuple is preventing the transaction from being closed

I am working with the Dapper lightweight ORM and this is my code public async Task(<T1, T2>) ExecProc<T1, T2> (string procName, SqlParams[] salParams) { try { using (Sqlconn ...
1
vote
1answer
34 views

Behavior of awaiting Promise Value

I am developing an application based on nodejs and electron, that has to retrieve data from an nedb-database. I have not fully understood the concept of Promises, or I think I have understood it far ...
0
votes
0answers
12 views

How to fix the callback for async.eachSeries for continues execution of entire array?

I need to execute the function on an array in node due to asynchronous I used async lib. Where do I add callback such that it returns and execution continues for rest of the array? async.eachSeries(...
2
votes
2answers
61 views

C++ Which thread pool is cppreference.com talking about?

I was reading the description of std::async at cppreference.com. The first description says : The template function async runs the function f asynchronously (potentially in a separate thread ...
0
votes
2answers
55 views

How can I use DispatchSemaphore with a Closure

I have a value that looks like this lazy var authHeaders: [String: String] = { if shouldTokenBeRefreshed() { let semaphore = DispatchSemaphore(value: 0) ...
0
votes
1answer
24 views

Javascript Cognito understanding async and await?

I'm calling this function to retrieve a user attribute, however when i'm testing the function the return result is always "test" and then it goes through "cognitoUser.getUserAttributes" and logs the ...
0
votes
1answer
24 views

Unit Testing a Timer?

I want to test that a signal is getting fired every 6 seconds. My code looks like this: class DataStore { var clinics: Int { return clinicsSignal.lastDataFired ?? 0 } let clinicsSignal = ...
0
votes
0answers
15 views

FireBase Asyc Call from Andriod Returning Null App Failing [duplicate]

Firebase async call returning null Tried adding Log.d which did not work. AnchorId is the class level object String getValueFromDataBase(String shortCode){ databaseReference.child("...
0
votes
0answers
15 views

Getting DOMException with playing video onload

I want to play a video when the website is loaded. For that I am using the following code: window.onload = function webisteLoaded() { var main_bg_video = document.getElementById("...
0
votes
2answers
41 views

Angular async validators 'updateOn' and Specific Condition

I am trying to get a async validator to only fire onblur and if a boolean is true. I thought I would be able to get it to work by converting the the updateOn args to an array and adding in a second ...
0
votes
1answer
50 views

How to call a single method “n” number of times asynchronously? [duplicate]

Currently we have a C# window service application to extract data from JIRA using REST API in a timely manner. In that application we have a method to extract the data from JIRA by passing the project ...
1
vote
1answer
44 views

Cancelling async tasks with semaphoreslim takes too long

Scenario is to queue tons of tasks of various kinds, throttle them for parallel processing, and be able to cancel them. My problem is that cancelling them actually takes longer than the tasks ...
0
votes
1answer
39 views

Async method with parameters called from Multiple tasks causes collision

I am new to asynchronous programming and am trying to upload say 2 files to a rest api in parallel. The upload process for each file consists of 3 rest calls 1. Initial put: To create the file 2. ...
1
vote
2answers
43 views

boost::asio problem passing dynamically sized data to async handler

I am processing custom tcp data packet with boost. Since all operations are asynchronously a handler must be called to process the data. The main problem is that I don't know how to pass the data to ...
0
votes
2answers
40 views

How to make ENumerable operations tread safe SynchronizedCollection?

When I use SynchronizedCollection, I can catch the exception System.InvalidOperationException Collection was modified; enumeration operation may not execute. in foreach cycle. If you look at the ...
3
votes
2answers
76 views
+300

Asynchronous and synchronous HTTP request on server side, performance comparison

I am trying to figure out the pros and cons of asynchronous and synchronous HTTP request processing. I am using the Dropwizard with Jersey as my framework. The test is comparing the asynchronous and ...
0
votes
1answer
26 views

How to get use a list from future and use it inside a listView

I'm trying to get a list of all files in a certain directory. I get the files from a future function called getUserVideos() if inside the function I try to printu the data, I can see the result, but ...
1
vote
1answer
38 views

How to implement nested async code with reactive programming?

I'm very new to reactive programming. Although I'm very familiar with functional programming and kotlin coroutines, I still fail to figure out how to use reactive programing paradigms to refactor ...
0
votes
2answers
21 views

Preact setState hook wont work within a setInterval

CodeSandbox Trying to useState inside setInterval of a preact/hook. This isn't working, looks like for ever iteration it's executing previous callstacks(?). Could someone help me understand and help ...
6
votes
1answer
69 views

How to sum a Stream of CompleteableFuture<BigDecimal> conveniently?

I'm looking for a non-blocking way to sum a Stream of CompleteableFuture<BigDecimal>. I already found topics closely related to this problem, like this. But unfortunately in my case I do have ...
1
vote
1answer
21 views

Light Gulp 4 task still throwing 'async completion' error

I've not used Gulp before, so I'm not migrating an old gulpfile to Gulp 4. I'm just trying to get a few basic tasks set up. However, regardless of the method I use to signal async completion as well ...
0
votes
0answers
7 views

Writing synchronous socket.io javascript [duplicate]

I have the following codes: First, it sends a package to the back-end using socket.emit, once it is done, initialize the chat var socket = io(); send_package(socket, user_uid, match_uid, room_id, ...
2
votes
3answers
36 views

Wait for multiple http requests to finish before running a function in angular

I have multiple http posts that fetches JSON data from a MySQL database. I want a function to listen to all of them and run the next piece of code once all of them returned that data has been received....

http://mssss.yulina-kosm.ru