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
4
votes
1answer
64 views
2
votes
1answer
62 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. ...
3
votes
1answer
51 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 ...
2
votes
1answer
61 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, ...
2
votes
0answers
41 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 ...
-1
votes
1answer
28 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 ...
2
votes
2answers
109 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 ...
7
votes
1answer
100 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. ...
5
votes
1answer
201 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 ...
5
votes
1answer
81 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 ...
2
votes
0answers
63 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. ...
3
votes
0answers
35 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 ...
3
votes
1answer
52 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, ...
2
votes
1answer
102 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 ...
1
vote
0answers
74 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 ...
3
votes
1answer
39 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 ...
4
votes
0answers
83 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 ...
3
votes
1answer
154 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 ...
2
votes
2answers
46 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: ...
4
votes
1answer
88 views

Wrapping an asynchronous generator in Python

Since Python 3.6 and PEP 525 one can use asynchronous generator: ...
3
votes
2answers
511 views

Async file copy/move

My effort to write async methods for copy/move a file in C# ...
1
vote
0answers
49 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 ...
0
votes
1answer
42 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: ...
1
vote
0answers
121 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'...
2
votes
0answers
259 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 ...
2
votes
1answer
87 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 ...
3
votes
0answers
69 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: ...
10
votes
1answer
121 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 ...
3
votes
1answer
140 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 ...
0
votes
0answers
30 views

Jquery tooltip with callback hover more tooltips displays delayed content

I have an html table with multiple rows and columns. ...
2
votes
1answer
106 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."...
5
votes
0answers
58 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 ...
1
vote
0answers
199 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 ...
4
votes
1answer
322 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 ...
1
vote
1answer
115 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 ...
1
vote
0answers
73 views

Implementation of Promise.race [closed]

I took a stab at implementing Promise.race(): ...
3
votes
1answer
100 views

Implementing `Promise.all()`

I took a stab at implementing Promise.all(): ...
1
vote
1answer
56 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 ...
5
votes
1answer
98 views

Cloud Function: Deleting from both Firestorage and Firestore in a kind of “batch”

I've written code that deletes a "post" the user has sent with my Android app. A "post" is made of an image (stored in Firestorage) named A, of a Firestore document named B which is the user UID (this ...
0
votes
1answer
462 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 ...
3
votes
0answers
80 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? ...
3
votes
0answers
206 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 ...
4
votes
1answer
649 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 ...
2
votes
0answers
178 views

Python Async Reqeust 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 ...
4
votes
1answer
270 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: ...
0
votes
1answer
157 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....
3
votes
2answers
79 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 ...
3
votes
0answers
210 views

Python AsyncIO pipeline

I wrote a small snippet to implement asyncio Pipeline - object that connects together Layers, and lets them create and pass ...
2
votes
0answers
75 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....
2
votes
0answers
99 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 ...

1
2 3 4 5
10