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.

94 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
99 views

Dealing Synchronous Request in Asynchronous Code

Problem I am trying to convert my synchronous code to an asynchronous implementation. Using aiohttp I was able to almost get where I want. My problem is how to ...
user101's user avatar
  • 151
4 votes
0 answers
257 views

Chat using async Python and sockets

I am trying out websockets using the python async framework aiohttp. Basically I have created a game which will include multiple ...
doctorsherlock's user avatar
4 votes
0 answers
269 views

Asynchronous Stripe API and aiohttp parameters formatting

I'm testing the Stripe payment API. I couldn't find a Python wrapper that provides asynchronous requests so I'm writing one. My first goal was to implement the async equivalent of ...
cglacet's user avatar
  • 233
4 votes
0 answers
108 views

Implementation of a time lock with Python's asyncio

I have no idea if this kind of lock is called time lock, but I need something for the following scenario: I'm making a lot of concurrent requests with aiohttp, and ...
rubik's user avatar
  • 503
4 votes
0 answers
287 views

Python server that performs sentiment analysis on Twitter data

I have a fully working Python server that utilizes Tornado, asyncio, websockets and tweepy(Twitter's Streaming api). The main point of this server is to receive a query from the user, call upon tweepy ...
Luis Averhoff's user avatar
4 votes
0 answers
42 views

Validating a collection of proxy servers with maximum possible throughput

I am validating a collection of proxy servers and trying to achieve the maximum possible throughput. I've tested a few different methods, such as Task.WhenAll, TPL ...
JohnWick's user avatar
  • 425
4 votes
0 answers
808 views

Update UI once all API calls are done

I'm learning Swift at the moment but I would like to produce well-organised code. The goal of my little app is to display the weather of my current location. I use : the API of Darksky : https://...
Adrien G's user avatar
4 votes
0 answers
448 views

Queue with "unlimited" buffer in Go

This is small piece of bigger puzzle, but usable by its own. It an attempt to have a nonblocking queue with "unlimited" (besides memory size) buffer length. Got unit-tests 100% statement coverage, it ...
canni's user avatar
  • 211
4 votes
0 answers
935 views

Aysnc call back to UI Thread

My main DLL is a .Net one that has an async running method and fires an event when it's done: ...
JayTee's user avatar
  • 141
3 votes
0 answers
60 views

Email sender worker-pool skeleton in go

How to refactor this go code to make it more easy to understand and to maintain? It is email sender worker-pool skeleton. To understand the working-pool logic I coded it without real email client and ...
Ali's user avatar
  • 131
3 votes
0 answers
101 views

HTTP download function in Rust (async/await)

Why am I fighting the compiler? - Wrote this, which works, but I feel like I'm breaking every rule in the book: ...
A T's user avatar
  • 485
3 votes
0 answers
428 views

Batching calls to server in python with asyncio

I've written this decorator to avoid too many requests to a backend. Did I get it right? Do I need some locks or can I assume some things are atomic / thread safe because this is asyncio? ...
Uri's user avatar
  • 131
3 votes
0 answers
311 views

Middleware which lets developer maintain dynamic context

Problem Statement: Users can chat while the replies of the chatbot are based on past messages. So the chatbot needs to have the context of the previous messages and reply accordingly. Here is ...
Vraj Shah's user avatar
3 votes
0 answers
832 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 ...
JOHN's user avatar
  • 131
3 votes
0 answers
403 views

Python AsyncIO pipeline

I wrote a small snippet to implement asyncio Pipeline - object that connects together Layers, and lets them create and pass ...
Illia Ananich's user avatar
3 votes
0 answers
665 views

Example Multiple Async Await Calls Javascript

I need to make an unknown number of api calls, up to 5 max probably. But most samples I've seen show only a couple of async calls so are effectively hard coded to the number of calls being made. This ...
kanine's user avatar
  • 31
3 votes
0 answers
255 views

Async in Railway Oriented Programming in F#

In F# the Railway Oriented Programming pattern can be implemented synchronously using the Result<'t,'terr> type as result value for functions, so they can be ...
user avatar
3 votes
0 answers
57 views

Node/Express authenticate Google email address

Trying to set up express server that will authenticate a user's Google email before proceeding. The code below works, but is there any way to make it more elegant? The whole ...
Dan G's user avatar
  • 31
3 votes
0 answers
202 views

Templatized GLib asynchronous queue

I'm working on a legacy C++ project, which is using GLib for its Main Event Loop. This has caused a lot of ugliness because it mixes C++ and C paradigms (no C++ wrapper for GLib had been used). ...
Wizard79's user avatar
  • 141
3 votes
0 answers
651 views

Collecting folly::Futures with an associated value

I'm trying to implement a batch API where requests are associated with an id. In the batch response, the individual success/failure responses should be associated to their corresponding request id. ...
Savior's user avatar
  • 131
3 votes
0 answers
4k views

Await in... VBA?

Asynchronous programming is tricky enough already, and VBA doesn't make life any easier. I wanted to create some basic functionality to allow async processes to mark completion without having to ...
Greedo's user avatar
  • 2,345
3 votes
0 answers
63 views

Status dispatching of my redux-thunk async action (post request)

I'm trying to dispatch to my reducers the current status of my request. So far I'm wondering how refined the status publishing of my thunk action. I feel like my code is very verbose and I wonder ...
CodingWeb's user avatar
  • 179
3 votes
0 answers
109 views

TextFileConvert - dos2ux and ux2dos in VB.NET

This provides text file conversion capabilities like the common Unix utilities "ux2dos" and "dos2ux". I needed the capability to perform Unix text file conversions, round trip, within a VB.NET ...
HackSlash's user avatar
  • 372
3 votes
0 answers
658 views

Making 10000 HTTP requests as fast as possible

I need a program that needs to gather data from large list of API end points. Below is a mock-up program that attempts to make 10000 requests as fast as possible. Any suggestions on how to improve on ...
rajendra's user avatar
  • 139
3 votes
0 answers
30 views

Testing whether pages can be fetched from two ports

I have an endpoint in my API which does a port test on 4455 and 4456 once a client GET's it. This is accomplished by requesting two web pages. The result will respond to the client with a JSON object: ...
Harvey's user avatar
  • 131
3 votes
0 answers
2k views

Cancel running Task on Dispose and race condition

I'm building a wrapper around NamedPipeServerStream and NamedPipeClientStream. Currently my ...
cogumel0's user avatar
  • 171
3 votes
0 answers
1k views

Asynchronous sockets with begin/end and a state machine loop

Disclaimer: I am a C++ guy, so my C# is not even close. Therefore some review might be helpful. Here is my 4th attempt at a client using asynchronous sockets. Please give feedback. The hardest part ...
Christopher Pisz's user avatar
3 votes
0 answers
315 views

Daemonizing shell scripts - MqSH

This is an mqtt driven, interactive, and asynchronous remote shell daemon written in bash. I call it "MqSH" or simply "mq". It works with bash, the busybox ash shell, and perhaps other Bourne-like ...
Shellz's user avatar
  • 61
3 votes
0 answers
393 views

Reading log file of subprocess

I run subprocesses with lot of output (compilation of Unity 3D projects). I use log parsers to find known issues. ...
abstrus's user avatar
  • 131
3 votes
0 answers
487 views

Basic Server/Client Model built around ASIO

For this project, I'm using the non-Boost version of the ASIO library. The basic idea is that it is a relatively simple stand-alone class capable of functioning either as a server or client depending ...
Xirema's user avatar
  • 247
3 votes
0 answers
132 views

Q.js worker pool

I'm building a program to scrape data about hockey games in order to compile statistics. One of the run modes will process all of the games in a single season (1230). Processing a single game consists ...
pgraham's user avatar
  • 400
3 votes
0 answers
96 views

Quick 'n' dirty job deferment

I'm just after some sanity checking of this code: ...
Adam Cameron's user avatar
2 votes
0 answers
138 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 ...
nop's user avatar
  • 719
2 votes
0 answers
965 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 ...
MHebes's user avatar
  • 143
2 votes
0 answers
74 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. ...
jwodder's user avatar
  • 302
2 votes
0 answers
2k 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 ...
Zohar81's user avatar
  • 153
2 votes
0 answers
1k 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 ...
Vikas Prasad's user avatar
2 votes
0 answers
501 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 ...
HaWe's user avatar
  • 53
2 votes
0 answers
239 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 ...
Marcel Tesch's user avatar
2 votes
0 answers
117 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 ...
V3n 4 C0ding's user avatar
2 votes
0 answers
59 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 ...
Harshit's user avatar
  • 183
2 votes
0 answers
84 views

I'm just starting out with tasks. I need to know if there's a better way to do TAP for socket handling (serving a request)

I've got this quick and dirty little console app in C# to serve an HTTP/HTML page. ...
honey the codewitch's user avatar
2 votes
0 answers
698 views

Asynchronous Web Crawler with Pyppeteer - Python

This weekend I've been working on a small asynchronous web crawler built on top of asyncio. The webpages that I'm crawling from have Javascript that needs to be executed in order for me to grab the ...
Will Meyers's user avatar
2 votes
0 answers
127 views

Concurrent execution and coordination of C# tasks

I have a class, 'TaskCoordinator' which has 'BaseTask's applied to it. The BaseTasks have OnStarted, OnFinished and OnCancelled events which are triggered to notify the calling class of their events....
Timmoth's user avatar
  • 21
2 votes
0 answers
311 views

Synchronous use of Mongo-Scala Driver

The Mongo-Scala Driver (v2.6) currently only supports asynchronous operations, although my use cases often seem to lend themselves well to synchronous reads. This may be to block downstream code ...
schwadan's user avatar
2 votes
0 answers
267 views

Node.js async task queue implementation

Here is an async task queue implementation. The idea is to reuse node.js standard library as much as possible. ...
kharandziuk's user avatar
2 votes
0 answers
191 views

Implementing an efficient async FileSystem class based on libuv in C++

I currently am working on a game engine written in C++ with libuv backed for io system calls. I have a FileSystem class that just 'works'. I am allow to read files without blocking but the current ...
Kurieita's user avatar
2 votes
0 answers
98 views

multiple AJAX requests and multiple SetTimeout animations

I wrote a piece of code that included multiple AJAX requests and multiple SetTimeout animations. I want the code to perform better, especially the SetTimeout sections. which part of the code should ...
Phoenix's user avatar
  • 81
2 votes
0 answers
3k views

Putting a Queue Between HTTP Request/Response

We currently have two legacy systems: the Consumer and the Worker. These systems are massively complex in ways that are not important to this review, but it is enough to say that a large-scale re-...
Phil Sandler's user avatar
2 votes
0 answers
349 views

Let Them Eat Lists, Eventually (Asynchronous Generic List Consumption with Spring and CompletableFuture)

I want to reduce some repeated code in my Java 1.8/Spring Boot application, and to that end I tried to make a reuseable asynchronous utility module. In essence its an async List.forEach that takes a ...
DapperDan's user avatar
  • 419