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
36 views

Nested Async ForEach loops

I have a two nested forEach loops, i tried using standard forEach and some own logic but it failed, than i tried the async library from npm with the code bellow: function addValue(data, callback){ ...
0
votes
1answer
19 views

Execute function depending on which async call returns first

While running a UI-test for a login flow, the user might already be logged in. In case the user is logged in, a logout needs to be performed first. In this case, I have to wait for either a sign in ...
0
votes
0answers
13 views

How can i use promises in jquery [duplicate]

I have three async ajax calls functions with callback functions for fetching info to the main page. Those functions are on another js file. Ajax_GetUsers(Fetch_Users); Ajax_GetContactTypes(...
0
votes
0answers
19 views

Using commit in actions with promises returns 'Getters & Setters'

I'm using Vuex's 'actions' to fetch from my database via an API. It works well and I have a console.log(jsonResponse) which shows the correct data. However, when I add commit('updateQuestions', ...
0
votes
2answers
28 views

Promise scope different at execution time

I'm trying to wait (Promise.all) on an array of Promises that run database queries using Sequelize.js, which resolves from a then. I'm pushing my promises as follows: for (furnix in shorthandFurni) {...
0
votes
3answers
25 views

How to store async fetched response to an array object

I have an async fuction which successfully retrieves a json object but I can't store this output in an array/variable which I want to use outside the function itself. The problem is not to console log ...
0
votes
0answers
40 views

Returning a value from a nested asynchronous function in JavaScript [duplicate]

I went through similar problems in this website and none of them worked for my case. It would be helpful if you could check this code and help me what to change. The value of gpoint_found does not ...
0
votes
1answer
18 views

objective c - for loop to fetch image from iCloud sequentially

on IOS, I need to get metadata for a selected set of images. But since the images are backed up to iCloud, sometimes it may immediately return (cached) and sometimes it may take a second or two. The ...
2
votes
3answers
47 views

How do I make a nested loop continue only after a asynchronous function has been resolved or how do I extend “.then” beyond the scope

I tried to prevent async problems with promises in the following code. By using a .then function everything within that function gets called after the function has been resolved. But now I have the ...
-1
votes
0answers
24 views

How can launch {} perform code without blocking the main thread if it’s running on the main thread?

I have an Android app that executes some work in the background. I start that work with launch {} from Coroutines that as advertised on their website executes without blocking the code underneath. How ...
0
votes
1answer
67 views

How to handle I/O of a subprocess asynchronously? [duplicate]

I have a subprocess, which may or may not write something to it's stdout in a specific amount of time, e.g. 3 seconds. If a new line in the subprocess stdout starts with the correct thing, I want to ...
-1
votes
2answers
25 views

wait for response from promise to populate form

Hello I am working on an angular/typescript application, I have read about the promises but it is not clear to me please of your help. have function getUserById() return user information, and ...
-1
votes
1answer
31 views

Proper way to run asynchronous function in a Promise

I am making a test app using systeminformation. I'm trying to make it so that each then waits for the previous function to finish. The problem I'm having is that the functions I am running inside are ...
1
vote
2answers
40 views

How to fix: “undefined response from fetch” Javascript

Been trying to fetch a link/image from an open API from the following guide: https://discordjs.guide/additional-info/rest-api.html#using-node-fetch but it is not working. I keep getting an undefined ...
0
votes
1answer
53 views

WPF how to await code inside controls events

I am using a 3rd party library that i cannot change how it functions. It is a lib wrapper that allows me to adjust video filters such as brightness and contrast on video files using the FFMPEG lib. I ...
0
votes
0answers
25 views

Using ngZone with rxjs subcribe

Inside my function getNext() i'm filling variables asynchonously via subscrybing observable function. When variable is filled i want to call a function next() of my ViewChild component ngslCarousel ...
0
votes
0answers
56 views

Fastest way to read Azure blob files in parallel

I'm trying to download the blob files from Azure using the below code Download Method : private static async Task<string> GetPriceString(int seriesId) { var maxRetries = 15; var ...
0
votes
1answer
35 views

Node.js - How to return callback with array from for loop with MySQL query?

I'm trying to get list of virtual communities on my Node.js app and then return it with callback function. When i call a getList() method with callback it returns a empty array. const mysqli = ...
1
vote
1answer
37 views

When would not using asyncio make sense?

In what cases would one threads or executors (using threads) over asyncio? As my experience using Python (CPython) has progressed, it has centralized around optimizing scripts at work to do some form ...
-1
votes
1answer
41 views

How to load multiple iframes concurrently?

I want to load 10-15 iframes simultaneously in such way that it can render whenever data received from URL. I have tried to use async function but it still working like one after one loading of ...
0
votes
2answers
19 views

setInterval executes functions only by the time of the interval ends

I have the next setInterval in JS which emits the test() function only by the time the 5s ends: let interval = setInterval(() => { test() }, 5000) function test() { console.log("Test") // ...
0
votes
0answers
19 views

I have synchronous HTTP POST request which I want to convert into Asynchronous HTTP POST request please reply in context to java

I have a Synchronous SMS sending HTTP POST request which I want to convert into Asynchronous HTTP POST request using Apache's Asynchronous Http try { String responseBody = ""; ...
-1
votes
1answer
16 views

Is there an async await method for “simple wait”

Say I want to surf the web every 10 minutes. Basically, I surf the web and then wait 10 minutes. I want the wait 10 minutes to be async and await. So within those 10 minutes, my program can do other ...
1
vote
1answer
26 views

Restart Async Coroutine without waiting for other coroutines to complete

I'm practising asynchronous programming in Python with the following problem: Simulate multiple people eating from the same food bowl with a set number of servings of food. Each person can take x ...
0
votes
0answers
18 views

Storing data using async returning null because of startup error?

Would this startup error be the reason for return null everytime I save data to a sql database using ayncs?: E/KernelCpuSpeedReader: Failed to read cpu-freq java.io.FileNotFoundException: /sys/...
1
vote
1answer
53 views

Playfab - ReferenceError: “Promise” is not defined

I'm creating a new little project in Google Spreadsheets to get some data from Playfab servers for a game in Kongregate. Playfab provides a Javascript API to work: https://download.playfab.com/...
1
vote
1answer
53 views

How do you get a for loop to run async?

I'm making a game with world generation and I want to display the generation progress on screen. Even with the for loop inside of an async function it stops all other code outside of the function to ...
2
votes
1answer
24 views

Fetch API in sync functions and for loop

var lineArr = []; var MAX_LENGTH = 10; var duration = 500; var chart = realTimeLineChart(); function getData() { fetch('./getRealTimeData').then((response) => response.json() .then((...
0
votes
2answers
61 views

How to handle async functions in Angular

//This is a function that is in my data service (in Angular) that basically gets data and puts it in an array getTenantData() { //This is the function that is called by app.component.ts //It's ...
1
vote
1answer
49 views

No continuation using the captured GUI context but why is there deadlock?

I am wondering why there is deadlock in the following case in which no continuation using the captured GUI context. public Form1() { InitializeComponent(); CheckForIllegalCrossThreadCalls = ...
0
votes
0answers
8 views

How to promisify a function for navigator geolocation?

I need to promisify this line of code: navigator.geolocation.getCurrentPosition(setPosition); Because the result from it is asynchrounus. I tried this: await new Promise (resolve => navigator....
0
votes
1answer
42 views

Stream and Future in Dart

I've been using basic async/await for some time without many problems and I thought I understood how it worked. Can't say I'm an expert in it, but I understadn the gist of it. I just can't get my head ...
3
votes
1answer
28 views

Exception “Collection has been modified”, when it hasn't been

I'm getting this exception with this code and can't understand why private static void LoopBTCtx() { Task.Factory.StartNew(async () => { while (true) { try ...
0
votes
0answers
39 views

JavaScript code works in debug mode and doesn't work in release

I am trying to do validations for csv file which is being uploaded while reading a file, for which am using the FileReader() The entire logic works perfect in debug mode but doesn't work in release. ...
2
votes
1answer
41 views

Node.JS async showing “Promise” in returned data

I have the following node.js function call and function var returned = checkCurrentProcesses() returned.then(() => { console.log(returned) }) function checkCurrentProcesses() { ...
0
votes
1answer
34 views

Batch async requests in JS

I've seen many answers here on Stackoverflow recommending people to handle multiple async calls using Promise.all. I do think that Promise.all() helps when the calls are made to do a similar job, but ...
0
votes
1answer
12 views

How to make asyncio task / coroutine return values to be assigned

TL;DR: I want to create asyncio task/coroutine and get the return values to be assigned in a var. - I found this question Getting values from functions that run as asyncio tasks Which seems to talk ...
1
vote
1answer
19 views

Why is mysql database information won't pass to express.js function?

I have this code app.get("/api/tables", function(req, res) { function retrieve() { connection.query("SELECT * FROM reservations", function(err, res) { if (err) throw err; ...
0
votes
0answers
13 views

forEach dont waiting to my await function [duplicate]

please see my code below. I want to do it so that my foreach loop will wait for the outcome that I commented on. Currently, my loop is doing: 1... 2... get results for getCurrencyExchangeRate(1)... ...
0
votes
1answer
24 views

What is the difference between happening of event on element and emiiting an event from element in dom?

I want to understand when I click a dom element, then click event happens on that element and associated event-handler function is called. This is a basic example of an asynchronous function. My ...
0
votes
0answers
36 views

Shared variable in a process and access it through another function

EDIT: Simple example provided below I am creating a flask web app and it has a function that needs to be run on the background and a variable from that process needs to be accessed but it is not ...
0
votes
3answers
37 views

How to get async conditional property inside Angular *ngFor loop of complex object

Let's assume I have empty observable object, which is filled up at some moment of time, with such data: const props$ = { prop1: 1, prop2: 2, prop3: 3, } And I have a loop with such data: ...
0
votes
0answers
34 views

Fire when task finished with promise

I have this JavaScript Code: members.reduce((chain, el) => { return chain .then(() => db.collection("users").doc(el).collection("user_data").doc("u").get()) ....
0
votes
0answers
11 views

Alternative for STDIO wrapper in node

I've got a script that uses 2 classes, say class A and class B. Class A contains an array of class B instances, often no less than 20. Class B performs computationally expensive and slow tasks, bottle-...
0
votes
1answer
36 views

How properly wrap async http requests into success and fail callbacks

I'm refactoring old code which does synchronous http requests and returns Callback object with success and fail events. How to properly wrap code into async/await? I've added HttpClient class and I'm ...
0
votes
2answers
26 views

Close a function by name outside the function

I have several asynchronous functions running, and I'm wondering if it is possible to close a function that is running in the background. With its name for example ? async function test(){ await ... ...
-1
votes
0answers
28 views

await SyntaxError: Unexpected identifier NodeJS

I trying use the async and await for save a schema object (mongoose). But the error is: back-end\controllers\Enfermero.js:761 var responseEstiloVida = await ...
0
votes
0answers
35 views

How to work with an array containing promises in javascript?

Working in NodeJS, I have a function that returns an array of objects. Inside these objects, many fields are populated by awaited promises, returned from an API. However, for some reason, this means ...
0
votes
1answer
13 views

Handling a method that takes too long to execute and is not awaitable

We are building a custom way to process timesheets using eConnect. A method is exposed that allows out timesheets documents to be submitted to GP. This method is run synchronously, but can take a long ...
0
votes
1answer
36 views

Getting Invariant Violation: Objects are not valid as a React child

My code doesn't work, it always returning Invariant Violation: Objects are not valid as a React child (found: object with keys {_40, _65, _55, _72}). If you meant to render a collection of ...