Questions tagged [asynchronous]

Asynchronous programming is simply allowing some portions of code to be executed on separate threads. It makes your applications perform better, be more responsive, and use the resources of the system they are running on to the fullest extent.

Filter by
Sorted by
Tagged with
0 votes
1 answer
28 views

Asynchronous recursive function for generating a unique Id

The code below is my first purpose built asynchronous recursive function. It took me a while to figure out how to write the thing, and I would like a second opinion. It's part of a project for The ...
user avatar
1 vote
0 answers
85 views

Asynchronous socket server implementation from raw sockets

I've rewritten my HTTP server several times over the past year, because I tend to encounter an issue midway through an implementation realizing I didn't abstract, decompose, or decouple certain ...
user avatar
2 votes
1 answer
33 views

Javascript function which polls an async endpoint and inserts the result in a web page

I read about debounce this morning and ended up needing something similar to the concept in real life this evening to build a poll that checks whether a link I receive from an async call is ready to ...
user avatar
  • 21
0 votes
0 answers
49 views

Asynchronously download lists of scholarships

TL;DR There is a script here that handles async stuff. Another script imports that file and uses content from it as a "normal" function. Please help me evaluate my async code, I am new to ...
user avatar
1 vote
1 answer
93 views

Collect and combine results of async calls returning completable futures in Java in a cleaner way?

I need an abstract way to implement this below functionality because in my code I have to use it in multiple places with different REST endpoints. If I ignore it will cause code duplication. Please ...
user avatar
0 votes
0 answers
36 views

Async generator that processes input enumerable in batches-at-a-time

I have a lot of Input documents, which contain collections of sentences. I would like to use an online sentiment API to attach sentiments to each of these sentences ...
user avatar
3 votes
2 answers
226 views

Blocking call to an async function

While migrating to structured concurrency it may be sometimes convenient to temporarily make a blocking call to an async function - e.g.: ...
user avatar
  • 601
0 votes
0 answers
36 views

Synchronous Lock system with asynchronous methods

I needed a way to ensure that a function called was done only one at a time. Because of how Javascript is done and with Asynchronous functions, this wasn't the case, and there could be concurrency ...
user avatar
  • 235
2 votes
1 answer
82 views

Resilient & Stable TCP Server Polling

I am looking for feedback to perfect my code developed for WPF in terms of speed, stability and resiliency. My code is supposed to handle synchronous status polling as well as asynchronous Commands to ...
user avatar
5 votes
1 answer
180 views

Task-based TCP socket wrapper class

Recently I've been entertaining the idea of making a small encrypted chat app as a way to learn about UI, encryption and networking in C#. After some research/work, I've produced the below protocol ...
user avatar
1 vote
2 answers
126 views

group countries by language in JavaScript

I need a better implementation than the below code (O(N) Solution), I am grouping countries by language ( data ) is the countries JSON, each country could have 0, 1 .. or more language as the object ...
user avatar
2 votes
0 answers
43 views

Asynchronous TCP server refactor design & not working features

I'm working on an asynchronous TCP server which is supposed to be used for a chat. I want to get a review for the TCP server part because I'm struggling to find a good design to fulfill the following ...
user avatar
  • 401
0 votes
1 answer
44 views

React async useEffect with loading and error state

This is my first time trying to add clean error handling and loading notification for async requests in my project. It looks kind of bulky to me, but maybe that's because I'm inexperienced? This is ...
user avatar
  • 11
2 votes
0 answers
86 views

A reuseable reconnecting TCP socket with Asio

I'm using (non-boost) Asio 1.18.1 and C++17. Forgive the boost tag, there wasn't a more specific one. I have a async_connect_with_retry composed asynchronous ...
user avatar
  • 153
0 votes
0 answers
116 views

Rust infinite loop in Tokio tasks join_all() made concurrency?

(From stackoverflow.com, they suggest me to post this question here) I'm trying to build a bot to check with accounts the status of a service connected to each of ...
user avatar
  • 111
2 votes
0 answers
58 views

Asynchronous line-based communication with an external program

As part of a larger project, I've written the following code for interacting with git-annex's addurl command in batch mode. ...
user avatar
  • 256
0 votes
0 answers
31 views

Overly complex code for a seemingly simple idea. Fulfilled promises returned instead of values

I have a React hook "useFetchSales" that fetches all documents from the "sales" collection in Firestore: ...
user avatar
2 votes
1 answer
100 views

Learning asynchronous caching by implementing one

After implementing a serial CLOCK second-chance cache in C++ without having enough rope to shoot myself in the foot, decided to dive into Javascript through NodeJs and write an asynchronous one. I ...
user avatar
3 votes
1 answer
73 views

Using the Decoder class in a streaming context

Am experimenting with the IAsyncEnumerable interface and PipeReader class. Have come up with the following to decode a stream of bytes into chunks of characters and am able to decode all of my test ...
user avatar
  • 1,840
2 votes
0 answers
509 views

Implement Websocket using boost::asio::beast with serialized writes

Here's a proposal implementation of websocket using boost::asio::beast that is thread-safe to parallel writes. In this example below, the ...
user avatar
  • 153
1 vote
1 answer
63 views

Is this good practice to declare variables freely inside async function?

example: ...
user avatar
  • 125
2 votes
1 answer
122 views

Best way of cleaning up resources with CompletableFuture [closed]

Edit: cross-posted this question on Stackoverflow. Suppose I have a function that takes a FileInputStream, performs some operation using the file data in the ...
user avatar
  • 123
1 vote
1 answer
114 views

My 3D to 2D graphics algorithm is being a bit slow

With my VB.Net Windows Forms application, I would like to rotate and project a 3D object. The program works so far, which is why I'm reporting here and not Stack Overflow, but it's slow. I've already ...
user avatar
  • 175
3 votes
1 answer
100 views

Converting python code to async calls

I'm going to start out by saying this is the 1st python program I have ever written and have no real background in the language so my code is probably pretty rough. Take it easy on me! When I wrote ...
user avatar
  • 61
0 votes
0 answers
32 views

Refactoring a simple ZeroMQ Server

I have a simple ZeroMQ client from zmqClient. I have refactored the code and done the following things. Created a class ZmqServer and added member variables and methods. Added a Server thread, using ...
user avatar
  • 161
4 votes
1 answer
69 views

Async streaming of Reddit posts

roux is a Rust library that wraps the Reddit API. Neither Reddit nor roux provides a stream-like interface for obtaining the ...
user avatar
1 vote
0 answers
411 views

Are nested calls to `asyncio.gather()` dangerous?

I wrote this ~100 line script recently, where I tried out Python's asyncio library. When it comes to asynchronous programming in Python, I just have 2 days of ...
user avatar
2 votes
0 answers
198 views

Read Data from a serial port and write to influxdb

I have a energy meter which sends the kWh count periodically every few seconds via a serial port. To store this data I write the counter value and the calculated average power of the last 10s in a ...
user avatar
  • 21
6 votes
1 answer
1k views

Async download of files

The following code is an async beginner exploration into asynchronous file downloads, to try and improve the download time of files from a specific website. Tasks: The tasks are as follows: Visit ...
user avatar
  • 375
2 votes
0 answers
168 views

Fixed-width non-FIFO DispatchQueue

I have implemented a custom concurrent queue on top of GCD which offers two additional pieces of functionality: Limit the maximum number of concurrently executing tasks. Give manual control over ...
user avatar
0 votes
0 answers
59 views

Idea for writing asynchronous data processing chains easier (similar to `ReactiveX`) and its implementation

I'm writing my own library, that is for asynchronous network communication. and then, wanna write my own HTTP proxy server for load-balancing connections to backend servers with it. when I'm using <...
user avatar
  • 95
0 votes
1 answer
462 views

Using asyncio and aiohttp in classes

To better familiarize with async requests I wrote a very simple scraper that relies on aiohttp to retrieve some basic information from the product page (product ...
user avatar
  • 195
1 vote
1 answer
97 views

Render multiple SSRS reports in parallel

This service takes in a report request object that can contain multiple reports that need to be rendered. This code works but I'm not sure if I've implemented anything wrong. Note the ...
user avatar
0 votes
0 answers
110 views

Asynchronous web scraping

This is my solution to a "vacancy test" task. I'm not sure at all if I have correctly implemented the task, but here is my solution. Goals of code: Parse rows of table from a URL and ...
user avatar
0 votes
0 answers
220 views

Fastapi with Aiohttp not providing expected results

I am new to asynchronous programming in python. Below are two scripts(which perform the same operation) one in Fastapi + aiohttp while other is basic Flask + requests library: ...
user avatar
3 votes
2 answers
154 views

Multithreaded logger

I made a multithreaded logger years ago when I was still a total newbie. It "worked" (when it didn't deadlock). Now that I'm slightly less newbie I'd like to get some criticism on this new ...
user avatar
  • 207
1 vote
1 answer
111 views

C# asynchronous tasks training (turn-based simulation)

I know embarassingly little about asynchronous programming in C#, so decided to start catching up. It would help me a lot if anyone checked this basic example I've created. Assumption: we're creating ...
user avatar
  • 113
2 votes
0 answers
75 views

CompletableFuture in Java, code that gets responses from different websites using HttpClient in Java. What can I do better?

I have a static list of Strings (website urls), I am trying to connect to them and get responses, in syncRequests method, I am using HttpClient in synchronous manner, in asyncRequests method, I am ...
user avatar
1 vote
0 answers
34 views

Stoppable asyncio thread class

A threading.Thread subclass intended for running an asyncio loop that has the ability to be stopped gracefully from another ...
user avatar
  • 625
1 vote
0 answers
67 views

What is the best way to call two async functions, one after another in spring?

Very new to spring and spring boot here... What would be the best practice for calling two async functions one after another? If I have three functions like this : ...
user avatar
3 votes
1 answer
63 views

Starting with asynchronous JS and promises

I've learn to code almost alone, so I really need some ideas/advice, as it started to get really difficult to advance. Because this is mostly server side, I can't provide a running snippet, but yet it'...
user avatar
  • 217
3 votes
1 answer
2k views

Alternative class to imitate AsyncTask class (deprecated) with Thread and Handler classes

As the title says, I have created an alternative class to imitate AsyncTask class (deprecated) with Thread and Handler classes but i feel uncomfortable to use it.(the app works fine with my class) Can ...
user avatar
1 vote
0 answers
220 views

vuejs: best practices with vuex when you call multiple actions [closed]

I am working on a project in which I am using vue js 2 and electron , to manage the state I use vuex , I have at least 20 actions to call ...
user avatar
3 votes
2 answers
425 views

Send multiple REST requests at the same time. (node)

Below is a (very) simplified version of a function I made that creates multiple REST requests to gather needed information. Things to note: One of the REST calls is dependent upon the output of ...
user avatar
6 votes
1 answer
75 views

How can this async url response checker be cleaner/faster?

...
user avatar
  • 101
2 votes
1 answer
756 views

Async tcp socket client: send multiple requests with one connection

I'm new to socket programming and c++. I have a the following method that sends an array to server and receives sum of the array, I tried to make it async. ...
user avatar
  • 23
3 votes
1 answer
59 views

Node.js package that retrieves data from an API, formats it and sends it out via email to a distribution list

I've created a Node.js package that retrieves data from Icinga (a monitoring platform), formats it and passes it off to a class that generates some HTML and then sends it all out as an email. The ...
user avatar
2 votes
1 answer
202 views

A method that calls multiple async tasks with error handling, done the right way?

I've got a method, CheckForValue(), that uses named pipes to send a message to another process running locally, and then receive a message from that process, ...
user avatar
2 votes
0 answers
48 views

design to send multiple type http request

I have to send multiple HTTP requests where their payload will be different, type will be different, headers will be different, URL will be different etc. The code I have right now is ...
user avatar
  • 183
-1 votes
1 answer
29 views

Am I using the same Typescript variable? [closed]

I am passing a in as a parameter and want to return b. This works, however I feel like it is wrong because I shouldn't have to ...
user avatar

1
2 3 4 5
11