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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

Why is `to_thread` faster than `create_task` in python asyncio?

I have a blocking function that calls an REST endpoint and returns some result. Let's simulate that as below: import random, time, asyncio def test_func(x): time.sleep(2*random.random()) ...
qkhhly's user avatar
  • 1,160
-1 votes
0 answers
22 views

withUnsafeThrowingContinuation Type of expression is ambiguous without more context

** I m trying to use make @escaping function to async/await with withUnsafeThrowingContinuation, but there is error Type of expression is ambiguous without more context** private func asyncUpload() ...
Ali Aibolatov's user avatar
0 votes
0 answers
19 views

Timeout context not inside a Task [Python 3.x]

I am not really familiar with async functions but I have worked in creating discord bots in the past and know some basics here and there to make it work. I am currently building a React based front ...
code-wolf-byte's user avatar
-2 votes
0 answers
16 views

"Handling asynchronous operations in Python with multiple threads – best practices?" [closed]

"I'm currently developing a Python project that involves handling asynchronous operations with multiple threads. I've looked into various options such as asyncio and threading, but I'm uncertain ...
Dhanush Kumar's user avatar
0 votes
0 answers
21 views

Send async generator using Python requests module

I'm using requests module in Python and I want to send data in request streaming way. so I applied chunked-encoded request according to this document. However, the data to send is provided with ...
jeongmin.cha's user avatar
0 votes
0 answers
7 views

Django websocket code is skipped when running server via nginx and asgi

In our code, AsyncJsonWebsocketConsumer.send_json() works fine when we are running the server via Django runserver but gets skipped when it is ran via nginx and asgi. This is the calling code and it ...
Warren's user avatar
  • 735
0 votes
0 answers
16 views

InputSimulator Keyboard.TextEntry is not working

I'm trying to open a notepad instance and write a virtual text entry to it. The notepad opens securely but nothing is written on it. What would be the problem and why? using System; using System....
Oscar RoAh's user avatar
-1 votes
0 answers
41 views

How can I fix thread synchronization issue with my below code?

I have the below code LoopAndTransferFilesAsync method. The summary for the same is as below: Asynchronously iterates through file transfer operations, fetching files from a provided database ...
Lucifer's user avatar
  • 2,315
0 votes
1 answer
20 views

How to make an asynchronous principle of task execution from a task generator?

I have a problem, do you have any ideas for a solution? You need to add asynchronous tasks to the event loop without waiting for them to be completed (using await is not an option, otherwise there is ...
aero.exe's user avatar
0 votes
1 answer
18 views

How to get the value from an asynchronous function for each element of an array and then use the values got to render in a React jsx component

I am trying to display some info that I fetched from an api. I can fetch and display the info as needed, but there is one information that requires another operation to be displayed. So I get the info ...
Edward's user avatar
  • 33
0 votes
1 answer
35 views

How to call an async function from a tkinter button

I want to call an asynchronous function from a tkinter button import asyncio import time import tkinter as tk async def gui(): root = tk.Tk() timer = tk.Button(root, text='Timer', command=...
Psionman's user avatar
  • 3,219
0 votes
0 answers
11 views

How to properly use async awaitAll in PHPReact?

I make a educational lesson with Async library https://reactphp.org/async/. Want to figure out how to work in async mode properly. So I made a 3 scripts. All 3 scripts connect to database 12 times. ...
Alma Z's user avatar
  • 254
-8 votes
0 answers
73 views

Is 100 percent multithreading possible in java? [closed]

Is 100 percent multithreading/Asynchronous Communication possible in java ? What if there is a particular resource which more that one thread wants to access ,If we use Locks or synchronized latches ...
aditya sharma's user avatar
0 votes
1 answer
57 views

Random "Unable to locate credentials" in the child processes on AWS EC2

I have an AWS EC2 host with 96 vCPUs I execute following script which spans async child processes up to a certain limit (passed as a script param). Each async child process calls AWS CLI and exits #!/...
Alexander Pavlov's user avatar
1 vote
1 answer
63 views

Implement an async builder pattern in Rust

I want to implement a future for a builder. This can be common for examples such as configuring a request via a builder, then sending it off. I want to implement IntoFuture for a builder but I cannot ...
Jinyoung Choi's user avatar
0 votes
2 answers
40 views

How make an asynchronous data fetching is completed before build method is called?

I am using the model view controller pattern and I have a view which uses data from the database to build the view's widgets. The problem is that fetching of the data is asynchronous, so I use the ...
Abdul Haadi Alhassan's user avatar
1 vote
1 answer
71 views

How to update a label multiple times Asynchronously after a button click

I have a website built on .Net Framework 4.8. I have a button that when clicked it will do remote calls to a server synchronously in order. There can be thousands of actions, and each action can take ...
SyndRain's user avatar
  • 872
0 votes
0 answers
31 views

Async file/image uploading failure after first requests in Java Sprint Boot

this is my first ever post on StackOverflow, so I hope I'm doing it correctly. Thanks in advance! I'm refactoring a file uploading function to an Async file uploading function. I am able to create a ...
Tjonna's user avatar
  • 1
0 votes
1 answer
9 views

PowerBiClient change cursor to default

I am creating a WinForm application which uses PowerBIClient package. In a UI event, the cursor is changed to WaitCursor by my code before calling a PowerBIClient async method. But the cursor is ...
JamesW's user avatar
  • 61
0 votes
1 answer
46 views

Asynchronous function in JavaScript not updating variable at the same time [duplicate]

I am trying to get the country that the user is in, then based on the country, I am initiating a useState called "FromCurrency". Everything is fetching successfully, the problem is that the ...
Program_Z's user avatar
0 votes
0 answers
24 views

How do I implement a timeout in python

First I send an order to a microcontroller to generate a signal, when I send an order I add the order to a map which contains tracked orders, this order contains the frequency, and duration, this ...
Mrmudkip's user avatar
  • 100
-1 votes
1 answer
47 views

NODEJS Async/Await Concept

I'm currently working on a Node.js application where I encounter scenarios involving multiple asynchronous operations with dependencies. I'm looking for advice on how to manage these complex ...
Rahul Garg's user avatar
0 votes
0 answers
22 views

Recursive relationship traversal and updates in SQLAlchemy + SQLModel?

I'm using SQLAlchemy with SQLModel and I have a series of nested relationships. I am working with SQLAlchemy ORM in Python and facing a challenge in handling nested relationships. I have a series of ...
thyde's user avatar
  • 111
0 votes
0 answers
29 views

How to retry CloudKit's async query method after a delay

I'm using the new async CloudKit .records method: var (matchResults, queryCursor) = try await CKContainer(identifier: "iCloud.MyDB") .publicCloudDatabase .records(matching: query) ...
Stan's user avatar
  • 89
0 votes
1 answer
10 views

Should Asynchronous function calls be cancelled before wait if error occurs in Ballerina?

Regarding Asynchronous function calls https://ballerina.io/learn/by-example/asynchronous-function-calls/ Should we call future.cancel() if the code between the future declaration and wait throws an ...
Sasindu Dilshara's user avatar
0 votes
0 answers
36 views

How fix error RuntimeError got Future <Future pending> attached to a different loop asyncio?

I reopen my questions, because last closed without answer I have a socket server. Processing of data that comes in occurs in separate threads. Then you need to write new data from the stream to the ...
test_celery's user avatar
0 votes
0 answers
15 views

Key rotation in paralel asynchronous requests to OpenAI with free tier keys

I am trying to develop key manager system that will take everytime new keys when current key runs into error or maximum retries per minute which is 3 as I don't have money to pay for bigger tier so ...
Bohdan Liutko's user avatar
0 votes
0 answers
19 views

AWS RDS SSL connection with FastAPI SQLAlchemy

I have to connect to AWS RDS using SQLAlchemy using SSL connection, but I am getting error asyncpg.exceptions.InvalidAuthorizationSpecificationError: no pg_hba.conf entry for host "106.213.85.14&...
hail_hydra_07's user avatar
-1 votes
0 answers
31 views

JavaScript Promises Asynchronous [closed]

const store = { sunglasses : { inventory: 817, cost: 9.99 }, pants: { inventory: 236, cost: 7.99 }, bags: { inventory: 17, cost: 12.99 } }; ...
Ivan Babic's user avatar
0 votes
0 answers
52 views

How to use dependency injection for helper classes after an API call returns in .NET?

I'm writing a .NET API that accepts a request, saves the request to a database, then runs further validation/processing. Since the validation takes a long period of time, we're saving the request to ...
Zachary Pataky's user avatar
0 votes
1 answer
29 views

OpenVino async inference for subset of images

I'm trying to implement async openvino inference for my service (that actually gets input images from a queue (using rabbitmq)). Found an official tutorial https://docs.openvino.ai/2023.2/notebooks/...
Ksenia Belozerova's user avatar
0 votes
2 answers
42 views

async keyword Future<dynamic> problem in flutter/dart . I just want to know how the code is generating an error here below

I dont know what is happening in this portion of code: Future fnct() { print("inside fnct()"); return Future.delayed(Duration(seconds:4),()=>"hello"); } Future fnct2() ...
Weirdo Memes's user avatar
1 vote
1 answer
72 views

How correct call await func in asyncio? [closed]

I created a socket server with asyncio. Reading from a socket is done immediately, but writing to a socket must be called from another class according to a condition. My implementation doesn't work. ...
test_celery's user avatar
0 votes
1 answer
22 views

How to pull data out of Async Fetch function

This seems like it should be very simple and basic, but I'm unable to get data out of an Async fetch function. Below is my code. Any insight into what I might be doing wrong is much appreciated. ...
aghosh03's user avatar
0 votes
0 answers
12 views

Java SmartCardIO and JavaFX: NFC On-Tap Functionality or Non-Blocking Waiting for Card Present

I am trying to accomplish something similar to the post here: Reading events from javax.smartcardio to detect presence of NFC tag, where an action is performed only when an NFC card is tapped to the ...
Phillip Ng's user avatar
-1 votes
1 answer
24 views

fireEvent.click() on NavLink not triggering history.push() in react testing library

I'm trying to verify that a certain route is called after clicking a link that is generated after an async api call. I tested for the occurrence of the link and the correct href attribute beforehand ...
Mike Czak's user avatar
0 votes
1 answer
45 views

How to run CPU bound async function in separate thread with asyncio.to_thread?

I'm making multiple calls to a 3rd party lib using asyncio tasks, wrapped in a function run_task, which is CPU intensive. I tried using asyncio.to_thread to run it in a separate thread but I am ...
indi qiqi's user avatar
-1 votes
0 answers
23 views

How do you wait for a Future object resulting from an API call to terminate?

I'm trying to wait for the results of a query to the api of my gradio chatbot but I don't know how to do it. I mean waiting for a Future object to complete. I thought .result() would wait for the ...
Revolucion for Monica's user avatar
0 votes
1 answer
48 views

Python Asyncio - wait for one specific background task to finish before starting the next

I have an app which collects data in batches. Every time it's done collecting one batch, it saves the data. In order to speed things up, I've been using asyncio so that it can continue collecting data ...
BENJAMIN GILBERT's user avatar
1 vote
1 answer
41 views

Concurrency problem with Redis in Node.js

Problem I have a key called stocks in my Redis and its value is 1000. Suppose 300 customers request to buy (100 stocks each) at the same time. In the end, only 10 customers should be able to buy. ...
Alireza's user avatar
  • 13
0 votes
0 answers
12 views

Troubleshooting Delayed ESC Key Detection and Program Exit in Rust CLI Tool with Crossterm and Tokio

I am writing a CLI tool which allows connecting to a remote server via SSH, dispatching a command, and streaming its result (in case the command is not instantaneous). I want the user to be able to ...
Th0rgal's user avatar
  • 723
1 vote
1 answer
40 views

How to write a custom socket server correctly with asyncio?

Python 2 has an implemented class with asyncore.dispatcher I need to implement the same in Python 3. class Server(asyncore.dispatcher): def __init__(self, host, port, socketMap=None): ...
test_celery's user avatar
1 vote
0 answers
11 views

Getting duplicated requests - getServerSideProps

I'm using "next": "13.4.0" with Pages router. I have an application that uses a payment platform called MercadoPago and i'm making the checkout proccess through this platform. The ...
David Drah Llensa's user avatar
0 votes
0 answers
24 views

Nested use of C++ std::async to create threads, which can delay the exception when there is insufficient resources

I am trying to simulate the exception behavior when the number of threads exceeds the linux limit. I found that when I continuously use std::async(std::launch::async, &func) in a thread, without ...
Consen's user avatar
  • 1
1 vote
0 answers
16 views

Tell scrapy to start executing some requests and not wait on creating all of them

I have a scrapy spider which downloads an input file from my private Github with around 1 million playlist IDs, which I want to search for using Chartmetric (a music data analytics tool). To this end, ...
thematthiaz's user avatar
1 vote
1 answer
24 views

save to file simultaneously opcua datachange notification

I subscribe to several nodes, so that I receive a notification only when the values change. I have to save the data to a csv file. The idea is to write rows with the timestamp + all the values of the ...
Marm90's user avatar
  • 13
4 votes
1 answer
105 views

When does setTimeout start counting down?

Here's the code I'm working with right now: setTimeout(() => console.log('first'), 2000); for (let i = 0; i < 5000; i++) { console.log("printing...") } setTimeout(() => console....
seeingstars's user avatar
0 votes
0 answers
33 views

Cannot Return CompletableFuture<ResponseEntity> From Spring POST Request

I am trying to return ResponseEntity from a post request after doing an asyncronous operation on spring boot server. This is simplified version of what i am doing: @POST @Consumes({ MediaType....
lastpeony4's user avatar
1 vote
1 answer
35 views

Can I rely on garbage collector to close asynchronous database connections in Python?

My team is working on an asynchronous HTTP web server implemented in Python (CPython 3.11 to be exact). We're using Redis for data storage and connect to it with the help of the redis-py library. ...
Alex F's user avatar
  • 406
0 votes
1 answer
36 views

Async would not run async in Dart

For loop in fu is only executed after for-loop in main. I thought that both loops would run at the same time? import 'dart:isolate'; import 'dart:io'; import 'dart:async'; main() { fu(); for (int ...
Jomme's user avatar
  • 1,275

1
2 3 4 5
1027