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
1 answer
2k views

Async collection loading for display in WPF/MVVM

In order to improve UX (User Experience) in WPF for huge collections, I would like to load collection items in asynchronnous and staggered fasion. While the WPF UI is virtualized by default, there ...
wondra's user avatar
  • 153
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
4 votes
1 answer
5k views

Disabling a form button while there's an http request running

I have a form built with react, formik and yup, and this form has some async validations. Apparently, some users were able to bypass these validations, and to prevent some errors, I wanted to disable ...
sergioviniciuss'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
4 votes
1 answer
926 views

Better way than setInterval to wait for an image load?

This is really a simple affair, I just wonder if there is a better way to do it: ...
martixy's user avatar
  • 253
0 votes
1 answer
455 views

Mixing Async and Sync in same HTTP request ASP.NET Core C#

Is it bad practice to mix async and sync call in same ASP.NET core API call? For example, in following code method CropBlackBroderOfAnImageAsync is an async method....
aamir sajjad's user avatar
3 votes
2 answers
86 views

Cleaner Way to Structure Asynchronous Code

The purpose of the code is to allow the user to select directories that will be crawled recursively in order to find particular files or file types to analyze en masse. The thing to bear in mind is ...
oldboy's user avatar
  • 151
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
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
312 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
4 votes
2 answers
2k views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
Nazar554's user avatar
  • 331
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
9 votes
1 answer
418 views

Operation cancellation

Brevity is for kings as it requires context and context is for kings. Me. GitHub and NuGet How many times you have been writing something like this passing those tedious logger/token parameters? <...
Dmitry Nogin's user avatar
  • 6,133
4 votes
1 answer
334 views

Data encryption / decryption on Node.js

I've implemented my first data encryption / decryption methods on Node.js. Although it might look similar to hundreds of sample implementations available online, I'm curious to get a feedback. I'm ...
Mike's user avatar
  • 277
3 votes
1 answer
241 views

Chain of CompletableFutures in Java

I am new to this CompletableFuture function in Java. I have the following code below that works fine but looks quite messy IMHO. ...
StealthRT's user avatar
  • 147
7 votes
2 answers
452 views

Action queue manager to perform action in a FIFO fashion

Recently, I needed a class that could execute code in a FIFO fashion in order to update parts of a WinForms or WPF UI which did not block the UI Thread and left the UI responsive to any interaction ...
Oscar Guillamon's user avatar
3 votes
3 answers
298 views

BindableBase with a throttle

I have project where I'm using BindableBase for my INotifyPropertyChanged implementation. Some of my objects however are ...
Jimmy's user avatar
  • 283
2 votes
1 answer
287 views

Python task runner with asyncio

I'm trying to a write super simple task runner with asyncio. Basically, my goal is to run 100 requests to google as tasks, whilst also being be able to handle tasks being added at a later time. <...
nz_21's user avatar
  • 1,041
2 votes
1 answer
376 views

Blocking requests within Express

Is this the correct way to block requests in Express? app.js ...
shorif2000'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
6 votes
2 answers
285 views

Asynchronous IBAN API with validation

I am working on an iban api which is about saving the iban of some members after (iban validation) in a database. The code is split between Domain (entities, behaviour for iban validation), Database ...
Natalie Perret'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
14 votes
2 answers
5k views

Asynchronous Circular Buffer in C#

Preamble I want to be able to test methods which communicate over a simple exclusively asynchronous two-way stream-like interface which may underneath use any of a number of communication methods (e....
VisualMelon's user avatar
  • 7,421
1 vote
0 answers
435 views

C++ - simulating Windows' IO completion ports in Linux

This is a simple implementation of IO completion ports in user mode for Linux. In Windows IO completion ports work like this: There is a global queue for issuing IO requests. Some worker kernel ...
dev65's user avatar
  • 303
1 vote
1 answer
182 views

Optimizing calls for reauthentication by caching tokens and cookies

I am currently developing a REST service in ASP.NET Core 2.2 that acts as a wrapper upon a REST API provided by a reporting solution. The reporting systems REST API authenticates the user based on a ...
Alexei's user avatar
  • 1,786
3 votes
1 answer
266 views

An asynchronous logger

I've written a simple asynchronous logger (playground): ...
Boiethios's user avatar
  • 600
3 votes
0 answers
256 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
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
0 votes
3 answers
578 views

C# Tasks for Asynchronous Operations

I currently use the following code to asynchronously create a cimsession to a remote host, query the remote host, return multiple values and finally updated some textboxes on my WPF window. Just ...
I.T Delinquent's user avatar
4 votes
1 answer
1k views

Wrap a callback method in an awaitable method

I'm using a .NET library which uses a pre-async/await type of asynchronicity. That is, it provides asynchronous (non-awaitable) method with a callback parameter. I'm trying to write awaitable ...
41686d6564's user avatar
2 votes
1 answer
131 views

Performing an action which may return other actions to be performed, concurrently

I have a program which, at its core, involves repeatedly performing an action on some value, and based on that action also returning a list of new values to perform that action on. The pure version of ...
Izaak Weiss's user avatar
4 votes
2 answers
156 views

Static site generator using JavaScript Promises

I have created a small static site generator (for learning purposes) in Javascript ES6, using Promises, but I am not certain of how to use them well. The code below works fine, but I wonder if i can't ...
Thomas's user avatar
  • 43
1 vote
0 answers
71 views

C# asynchronous notification vector v2

As a result of my previous post, I have implemented / refactored my code and have started making successful use of my class. However I have come across a couple of new questions: The observer must ...
sfanjoy's user avatar
  • 233
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
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
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
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
2 votes
0 answers
63 views

REST API request automation [closed]

I created a class to automate some requests for an API. Can I improve this code in any way? The code itself is very simple and easy to understand. ...
Johsn's user avatar
  • 29
6 votes
1 answer
150 views

C# asynchronous notification vector

The purpose of this class is to efficiently notify another thread when data is available with minimal blocking to access/pass the data. The data reader/producer thread processes data in bulk which ...
sfanjoy's user avatar
  • 233
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
6 votes
2 answers
2k views

Parallel FTP client

I was given the task to download files for a FTP server. The download should be fairly fast. 15 parallel connections can be used. I have used FluentFTP as the ...
inwenis's user avatar
  • 303
1 vote
1 answer
142 views

Asynchronous wrapper for database connection

I'm using a database that has a library for access to it. Connection is done synchronously, it's blocking and I do not have a way to abort it. To connect, I have to write: ...
Loreno's user avatar
  • 143
-1 votes
1 answer
2k views

C# Handling Task Cancellations/Timeouts and Exceptions [closed]

I am very new to Tasks and therefore new to handling task cancellations and task exceptions. I wrote this method that gets a List which is then used to populate an ObsservableCollection shown in a ...
cd491415's user avatar
  • 107
1 vote
0 answers
52 views

Asynchronous retrieval of WebExtension browser history visits

I'm writing a small class that wraps the existing functionality of browser.history.search in Firefox's WebExtensions API. The current API only directly searches for ...
rovyko_'s user avatar
  • 131
2 votes
1 answer
769 views

C# Async/Await networking server

I made a simple async networking server and I'd like to get some input on the code, whether things can be done better and whether the code is stable (able to hold more than 1000 connections without ...
Jacquie T's user avatar
1 vote
0 answers
3k views

Async SelectMany implementation

Async SelectMany takes an enumeration (length unknown) of tasks, each of which returns another enumeration (length unknown and likely different from one another), and returns results from the second ...
Jean-Bernard Pellerin's user avatar
2 votes
1 answer
99 views

Upload a file asynchronously

I need your opinion about my practice. I want to improve it. The requirements are the following: RESTFUL + OWIN (SelfHosted) Endpoint - Upload a file asynchronously Make a request to the endpoint ...
r35daleney's user avatar
1 vote
0 answers
92 views

Aggregate sensor readings from multiple sources

I've developed a toy example to investigate how async works in C#. Though I've learned a lot this week, I'm still unsure of the finer details, as this is my first C#...
Mike Ekim's user avatar

1 2
3
4 5
11