Questions tagged [async.js]

A module with functions for working asynchronously with JavaScript that can be used both in NodeJS and in the browser.

Async is a utility module which provides straight-forward, powerful functions for working with . Although originally designed for use with , it can also be used directly in the browser.

Resources

1009 questions
-1
votes
1 answer

Callback was already called in async.map

Edit: "threads"+"async" modules are not async(if not thread) safe! It was being called by another async function! Thats why thread running it twice before a single async completed. There was some code leftovers calling same code asynchronously. Here…
huseyin tugrul buyukisik
  • 11,469
  • 4
  • 45
  • 97
-1
votes
1 answer

Running Functions Synchronously in NodeJS (MongoDB Operations/Async.js)

I'm trying to do something fairly simple it seems in NodeJS - I want to run functions, one at a time. All of these functions have callbacks. I have outlined my code below, as well as the function that they run for further reference. My problem is…
-1
votes
1 answer

How to implement set of async task with some condition in series?

I have to write the following code in nodejs: val1 = async1() if(val1 == 0){ val1 = async2() } val2 = async3(val1) In the above code, val1 and val2 are the values returned from asyncronous functions async1(), async2() and async3() How can I…
Vishal
  • 467
  • 1
  • 8
  • 17
-1
votes
1 answer

Async: run single function

All async.js operators seem to be made for collections only. Is there a way to run this piece of code: async.series([ function (callback) { TripDao.getTrip(callback); }], function done(error, result)…
Amio.io
  • 20,677
  • 15
  • 82
  • 117
-1
votes
1 answer

Writing asynchronously to a text file using async.mapLimit

I'm trying to write numbers between 1 and 100 (order isn't important) to my text file, but only 99 is added. What's wrong here? app.get('/async', function(req, res) { // I create my array here. var arr = []; for (a = 0; a <= 100; a++) { …
salep
  • 1,332
  • 9
  • 44
  • 93
-1
votes
1 answer

Object not modifying on async.each

I have the following code: async.each(strategies, function (strategy, callback) { filterEventTypes(strategy.eventType, function (err, res) { strategy.filters = []; var filter = {}; filter.eventTypeIds = res; …
Ricardo
  • 9
  • 2
-1
votes
1 answer

nodejs async library and redis

After a long time of "no.. I don'*t want to do this.." I finally need to use the async.js library. I have no glue how to use it in a way it will make me happy... Let's consider this pseudo function which is very simplified: Seriosly.. I don't even…
user2429266
  • 390
  • 1
  • 3
  • 19
-2
votes
1 answer

Javascript addEventListener is Not being Executed or is There an await Problem

I have a Chrome extension with the following js code in the initial HTML. (async() => { console.log("Starting wrapper"); await document.getElementById("start").addEventListener("click",sendStart); await…
-2
votes
1 answer

Parent function is not waiting for child to finish

Inside getMetadata(), Object.keys function is not waiting for httprequest to finish. How can I make object.keys function to wait till httprequest function manipluates the result variable? I'm using node. I tried to make promise but failed. function…
-2
votes
2 answers

Node.js async taking too long to execute

I've got my array of queries var array = [ 'UPDATE EVALUATION SET mark = "16" WHERE id_eval = "21" AND id_usr = "125"', 'UPDATE EVALUATION SET mark = "9" WHERE id_eval = "22" AND id_usr = "125"', 'UPDATE EVALUATION SET…
Evgeny
  • 107
  • 3
  • 17
-2
votes
2 answers

NodeJS Async: callback allready called?

I am getting this error: node:19100) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Callback was already called. On my async.each call, it seems like it is trying to call "done()" more then once per…
0xtuytuy
  • 1,494
  • 6
  • 26
  • 51
-2
votes
1 answer

False routing in express.js

I am trying to use the following filter to divert packages but it fails: I've build to routes using express.js: app.get('/billdetails/:year/:month/:phoneId', function (req, res, next) { var db = req.db; var year = req.params.year; var…
icodeweb
  • 3
  • 1
-2
votes
1 answer

Nested async functions

With the following code, can I be sure that the last callback will return the updated variables? var a = 0; async.forEach(collectionarray, function(item, cb1) { async.forEach(collection.anotherarray, function(item, cb2) { a +=…
joe.js
  • 271
  • 1
  • 2
  • 12
-2
votes
2 answers

why it is possible to pass the undeclared function to setTimeout

Here is the code example from Trevor Burnham's "Async JavaScript" book (The Pragmatic Bookshelf, 2012): var async = require ('async'); var start = new Date; async.series([ function(callback) { setTimeout(callback, 100); }, function(callback) {…
Volodymyr
  • 1
  • 2
-2
votes
2 answers

Expressjs, async and middleware does not work properly

I'm doing tests with the framework expressjs in which I am creating a middleware that runs before the blocks of routes, but it does not work correctly. I thought it could be my code that escapes the asynchronism and it does not run correctly, but I…
Anto
  • 313
  • 1
  • 3
  • 13
1 2 3
67
68