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
1 vote
0 answers
34 views

Telegram bot computing a heavy I/O task

Introduction I have a telegram bot based on aiogram framework. It does GPU intensive computations locally then user makes a request and outputs a text file after ...
1 vote
1 answer
150 views

Using Swift Combine's .map function with external variables

I have a motionManager class which uses CMMotionManager() to send rotationRate and attitude values to a publisher in the form of a MotionValueModel. ...
1 vote
0 answers
48 views

Debounced inotify watcher in rust

Here is a tiny (cli) tool to run a script with the state of any of a set of watched files when one of them is opened or closed. It applies basic debouncing to handle bursty access. It was written to ...
3 votes
1 answer
172 views

C++ Readers-Writer Lock using Asio's Strands

The locking mechanism is implemented in the class RW_Lock. The saved_async_completion_handler structure is used in ...
0 votes
0 answers
105 views

For loop vs If statement using conditional variable

I'm extending the sync.Pool type by limiting the amount of objects that can reside outside the pool. To achieve this I'm using ...
7 votes
1 answer
1k views

C++: algorithm that uses fixed-size buffer of data that are produced in stream, faster than the algorithm speed

I try to implement this scenario with a producer/consumer multithread pattern and I'd like to optimize synchronization and memory model directive used. This code originates from a SO question and its ...
5 votes
2 answers
127 views

Get files downloaded asynchronously after double clicking on list item (C++)

The problem I am trying to solve as an exercise is as follows: I have a UI running in the main thread, specifically a list view with many items. Each item represents a file that the user can download....
2 votes
1 answer
70 views

Single worker, multiple async callers in different threads

My use case is this: There is a long running process that I want to ensure is only ever running at most only a single time. Multiple consumers from different threads may wait on the calculation. If ...
4 votes
2 answers
2k views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
5 votes
1 answer
716 views

Golang Tour Web Crawler Exercise

In the last few days I've played around with Go a little and took the language tour. The last exercise (text here) requires you to crawl a graph that simulates a set of Web pages with links, using ...
2 votes
2 answers
245 views

Code for asynchronous data stream processing with multistage pipelines

I am trying to write some code for processing streams of asynchronous data from multiple sources (Producer Nodes), process them ...
0 votes
0 answers
45 views

Visualizing a mashup API in Postman

The MusicBrainz API has information about artists and music bands. 1 An example – a request for the British rock band Coldplay is: http://musicbrainz.org/ws/2/artist/cc197bad-dc9c-440d-a5b5-...
1 vote
1 answer
420 views

Make C++ Task class similiar to C#'s Task

I am enjoying making various programs with C++. This is my first code review request. And I hope I can get some insights or might have good advice to make my code better. I make a task class using C++...
1 vote
2 answers
381 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 ...
2 votes
2 answers
865 views

Cleaning up nested promises in Cloud function

I am writing the Cloud function for Parse whose purpose is to update my database with a provided array of data objects. The main problem are the nested promises, which doesn't look right. Any help ...
0 votes
0 answers
65 views

UIImageView loading from URL with cancellable task and safe to use in a UICollectionView

I am trying to make a UIImageView class / extension that can load an image from a URL. the image view should not get confused with concurrency when scrolling through a UICollectionView and the data ...
6 votes
1 answer
848 views

Asyncio HTTP Request Queue

I wrote a simple sitemap.xml checker using asyncio and aiohttp. I followed the documentation demonstrating the producer/consumer pattern. However, I noticed that as the URLs scale larger, it seems to ...
6 votes
1 answer
2k views

Execute coroutines in pool

I want to run all the coroutines from the list in a pool of constant size and would like to ask if this is the right way how to achieve it. Is there any built in solution for this problem? I have not ...
0 votes
0 answers
33 views

Asynchronously building a service container in TypeScript

The compiler provides a synchronous use() method which accepts a middleware - that is a function that creates any services it wants, the ...
4 votes
1 answer
826 views

Asynchronous file writer : queue, mutex, condition variable

As we know, it is better to write to a disk in a separate thread because the bottleneck may be the disk, which is slower than the CPU (at the condition only one thread writes to the disk). So I have ...
2 votes
1 answer
446 views

Tool for asynchronous IPC using pipes

Description of the code: The code provides asynchronous IPC functionality in C++ using the Boost libraries and pipes. Each process asynchronously "listens" on the read end of the pipe and ...
7 votes
1 answer
336 views

Calling other machines from the LinkedList if one is blocked or down

This is a follow on to : Simplifying asynchronous "executeAsync" method along with "onFailure" callback. I am using AsyncRestTemplate as my <...
0 votes
0 answers
193 views

Asynchronous DB session in Python (used in ASGI framework such as Sanic)

I've been working with Sanic as my default web framework, but coming from Flask, I had some issue with how to handle the database connection. So I built an asynchronous wrapper around it. I've also ...
3 votes
1 answer
332 views

SetTimeout to populate Javascript Object while a function looped AJAX requests to get data

I wrote some code that will get the name and data of a node or multiple of nodes and put them in an object (seriesData) so I can use said object for a chart (renderChart). I used setTimeout() so ...
4 votes
1 answer
2k views

Is this SqlConnection / SqlCommand async wrapper both efficient and correct?

This is my first time writing async code, I intend to inject the interface IConnection into other classes in my project. Can you please tell me if the implementation class Connection, is the correct ...
9 votes
3 answers
34k views

Running 2 sets of tasks at the same time

Currently, my team and I have 2 types of databases that are updated periodically, SQL Server and Access. Also, we run specialized reports based on those databases. Basically, we have 4 tasks that ...
3 votes
2 answers
798 views

Wait for a callback and then using the result

I'm using Frida to run a script on a process, and I want to wait for it to send the result back to me, as a callback. My current code looks like this: ...
5 votes
3 answers
303 views

Asynchronous Pattern

I have an n-tier solution which consist of DAL,BL and a ASP.net WebAPI project. I'm new with Asynchronous Pattern and I'm trying to add it to my Framework. Am I using the asynchronous pattern ...
2 votes
2 answers
61 views

Load data from database, change it asynchronously and return the new data

I have written this function to load data from the database, change it asynchronously and return the new data. It appears to work fine, but since I am new to Kotlin, I wanted to ask if this code is ok ...
1 vote
0 answers
198 views

Promise in an Express app to send OTP verification e-mail

In this code I'm using nodemailer for sending otp email from my gmail account. I have also used ejs for creating html templates for emails. This code works perfectly, but I am a bit concerned about ...
7 votes
1 answer
370 views

AutoResetEventAsync, am I missing something?

So I wrote an asynchronous version of AutoResetEvent: ...
4 votes
2 answers
404 views

Game loop using Future.wait_for to check for input

I started writing this game from scratch yesterday, and I wasn't completely new to C++'s future library. I only use the ...
6 votes
1 answer
8k views

Use and understanding of async/await in .NET 4.5 +

I am just about to embark upon a massive job of multi-threading a cost-engine. I could use TPL of which I am very familiar, but would like to leverage the async/<...
5 votes
1 answer
402 views

Filtering an Option Result using a boolean Result in Rust

I'm trying to rewrite one of my pet projects in Rust, and when I was faced with the problem of filtering a Result<Option<T>, E> via a ...
0 votes
0 answers
274 views

ASP.NET Core 6 background DB logger

In an application, many actions need to be logged in the database. but this logging process should not slow down the request. So they should be done in an asynchronous queue or something. This is my ...
2 votes
1 answer
266 views

Java class to run CompletableFuture<T> instances in batches

This is a utility class for running CompletableFuture<T>s in batches (e.g. to avoid using too much bandwidth making HTTP requests). It seems to work, but I'm ...
0 votes
1 answer
255 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 ...
1 vote
0 answers
439 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 ...
9 votes
1 answer
2k views

Asynchronous Array.map

I put together an asynchronous map function for Swift's Array using Grand Central Dispatch. It's called with a transform closure,...
1 vote
1 answer
2k 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 ...
2 votes
1 answer
150 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 ...
8 votes
1 answer
4k views

Web Scraping with Python + asyncio

I've been working at speeding up my web scraping with the asyncio library. I have a working solution, but am unsure as to how pythonic it is or if I am properly ...
3 votes
0 answers
831 views

Python Async Request using Tor and User-Agent Rotation

The code below will scrape data from three APIs. The APIs are for property listings. So, for each listing, I will have one request. There will be around 20000 requests. That's why I use ayncio to make ...
3 votes
2 answers
816 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.: ...
5 votes
1 answer
624 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 ...
0 votes
0 answers
53 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 ...
2 votes
1 answer
419 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 ...
0 votes
1 answer
97 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 ...
2 votes
0 answers
137 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 ...
2 votes
0 answers
964 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 ...

1
2 3 4 5
11