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
0 answers
65 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 <...
jay k's user avatar
  • 85
0 votes
1 answer
1k 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 ...
anddt's user avatar
  • 195
1 vote
1 answer
414 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 ...
Usman Khan's user avatar
0 votes
0 answers
132 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 ...
Давид Шико's user avatar
1 vote
0 answers
517 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: ...
Charlie Chap's user avatar
3 votes
2 answers
396 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 ...
Barnack's user avatar
  • 207
1 vote
1 answer
248 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 ...
BFyre's user avatar
  • 113
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
1 vote
0 answers
76 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 ...
Anakhand's user avatar
  • 645
3 votes
1 answer
67 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'...
Minsky's user avatar
  • 239
4 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 ...
Bulutay Saraç's user avatar
1 vote
0 answers
323 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 ...
kevinG73's user avatar
3 votes
2 answers
2k 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 ...
Scotty Jamison's user avatar
6 votes
1 answer
87 views

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

...
humid's user avatar
  • 101
2 votes
1 answer
2k 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. ...
Abraham's user avatar
  • 23
3 votes
1 answer
64 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 ...
Arran Scott's user avatar
2 votes
1 answer
491 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, ...
user3591541'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
-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 ...
user10076130's user avatar
2 votes
2 answers
2k views

Adding some wait time between API requests to avoid overloading the server

In Shopify a product can belong to a collection. I have written a method which accepts an organisation. It would then get a list of collections that this organisation has from Shopify. Finally, it has ...
Hooman Bahreini's user avatar
7 votes
1 answer
293 views

VBA-Sync code feedback

I was hoping to get some input on a class module I'm designing to abstract away the boilerplate of utilizing asynchronous queries in VBA. cQueryable supports both synchronous and asynchronous queries. ...
beyphy's user avatar
  • 171
6 votes
1 answer
853 views

Nodejs async with express server

I use the following code which works as expected. The code uses open ID connect to login user. Because I'm pretty new to node and express, it will be great if I can ...
Beno Odr's user avatar
  • 119
5 votes
1 answer
90 views

Synchronous logging of asynchronous retrieved folder info

I started learning functional programming with JavaScript and I have the basic idea of Functors, container types and etc. I was trying to experiment with arrays but I don't know how to solve the ...
Ricardo Silva's user avatar
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
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
1 answer
869 views

NodeJS executing multiple database queries using async library

I have a use case where I need to run multiple tasks in series. Each task is required to perform some database operations. In my code step_1, ...
Dakait's user avatar
  • 133
2 votes
1 answer
1k views

Parse and clean log files

I have the code below, which works successfully, and is used to parse, clean log files (very large in size) and output into smaller sized files. This would take about 12-14 mins to process 1 GB worth ...
rogerwhite's user avatar
1 vote
0 answers
482 views

Sending emails asynchronously

In a part of our system a lot (I'm not sure how many, probably a couple thousand) of emails are being sent to the users at a specific time of the month. It seems this kills the server. So I was asked ...
Igavshne's user avatar
  • 111
3 votes
1 answer
44 views

User Access Authorization for Web Resources

Im refactoring a large internal legacy application and part of the stuff I want to get rid is the widespread code repetition. I'm starting with the way the website checks if a User can access a ...
10110's user avatar
  • 171
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
3 votes
1 answer
356 views

A thread-safe typed Promise implementation in Java for Android

Introduction I've created a typed Promise implementation in Java for Android, borrowing ideas from this article for a JavaScript implementation, by Forbes Lindesay. To allow for "asynchronicity", my ...
Codifier's user avatar
  • 178
2 votes
2 answers
90 views

Python 3.6+ Conventions for fetching paginated data

I find myself often encountering a use case where I need to fetch paginated data, where I need all of the data. Currently I use something similar to below to handle these cases: ...
SumNeuron's user avatar
  • 271
4 votes
1 answer
2k views

Wrapping an asynchronous generator in Python

Since Python 3.6 and PEP 525 one can use asynchronous generator: ...
Delgan's user avatar
  • 551
3 votes
2 answers
6k views

Async file copy/move

My effort to write async methods for copy/move a file in C# ...
Phate01's user avatar
  • 155
1 vote
0 answers
50 views

Awaiting the completion of a server request

I faced the following problem. I have a Server object server which exposes TriggerStateChangeAsync() which return an ...
Ackdari's user avatar
  • 121
0 votes
1 answer
92 views

Best approach on handling function that returns either a promise or just synchronous code [closed]

I wrote some code and I'm trying to get some feedback on it. I'll try to summerize the essential only. I have a function that based on a condition returns a promise or something else: ...
Ionut Necula's user avatar
1 vote
0 answers
357 views

create vscode tree item extesion

I use the following code to add tree item to vscode extension, Im getting the data and build the tree according to the entries I got, the code works. As I new to typescript I appreciate your feedback'...
Jenny M's user avatar
  • 281
2 votes
0 answers
699 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
1 answer
325 views

Asynchronous TCP network server with a packet system

So I'm writing a game emulator and would like some advice after finishing the networking. It is designed to accept multiple connections, and process messages from all of them. Here is just a brief ...
Josh Hallow's user avatar
  • 1,305
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
10 votes
1 answer
162 views

Wordcloud from all answers of a user here on CR

Since I haven't really used Python's new async features yet, I took some older code of mine, which took all of my answers here on Code Review and generated a word cloud from them, and updated it to ...
Graipher's user avatar
  • 40.8k
3 votes
1 answer
1k views

Write a wrapper to REST API with asyncio

I want understand how to correctly structure a functional asyncio-based program. The code below wraps two external APIs to provide the client a simple ...
Pablo's user avatar
  • 95
2 votes
1 answer
124 views

Can this async method be improved or simplified

I was tasked to write process that initially seemed like a straight forward thing. "Fetch data from database, create a cache object, and assign this data to it. Use existing class to model this after."...
Risho's user avatar
  • 21
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
1 vote
0 answers
1k views

HTTP Client - Best practices

I've made a HTTP client and would like some tips to improve my code, it's supposed to be built for xamarin forms but should work with any implementation. My goal of this project was to learn more ...
JsonDork's user avatar
  • 414
7 votes
1 answer
3k views

Python: Asyncio object-oriented style

I'm seeking a review of some code I've written for a small personal project. The project is not yet mature enough for any domain specific details to be of concern - but I'm happy to provide further ...
Adam Hodgson's user avatar
1 vote
1 answer
611 views

Asynchronous logging using custom log4j appender and ExecutorService

I have a requirement to send emails when certain errors are logged(using log4j 1.2.17). But the SMTP appender sends emails in a synchronized manner. I can not use the AsyncAppender either. So I have ...
Umendra Rajapakshe's user avatar
1 vote
0 answers
134 views

Implementation of Promise.race [closed]

I took a stab at implementing Promise.race(): ...
Tobi Alafin's user avatar
  • 1,806
4 votes
1 answer
164 views

Implementing `Promise.all()`

I took a stab at implementing Promise.all(): ...
Tobi Alafin's user avatar
  • 1,806
1 vote
1 answer
112 views

Using Reactive Extensions in an Asynchronious Way

I am new to Reactive Extensions, I have the requirement to consume PairCollection<IPointCloud> which are fed into a service which performs a very expensive ...
MoonKnight's user avatar

1
2
3 4 5
11