diff src/google.coffee @ 22:b90e6df48d2d

eachLimit instead of each
author Mathias Gebbe <mgebbe@intevation.de>
date Mon, 16 Jun 2014 17:31:05 +0200
parents 6b3f38af3fa4
children 723eaf36902c
line wrap: on
line diff
--- a/src/google.coffee	Fri Jun 13 21:21:41 2014 +0200
+++ b/src/google.coffee	Mon Jun 16 17:31:05 2014 +0200
@@ -44,16 +44,16 @@
       getFriends(user,callback)
   ], (err, friends) ->
     # für jeden Freunde tue dies: hier bewusst von  async.eachSeries friends, ((friend, callback) -> auf async.each gewechselt
-    async.each friends, ((friend, callback) ->
+    async.eachLimit friends, 10, ((friend, callback) ->
       async.waterfall [
         (callback) ->
           getStream(user, friend, callback)
         (stream, callback) ->
           return if not stream? or not stream.items? or stream.items.length is 0
-          async.each stream.items, ((post, cb) ->
+          async.eachLimit stream.items, 10, ((post, cb) ->
             async.waterfall [
               (callback) ->
-                FromESN.search {uid: post.id + "@google_to_" + me, recipientUser: me}, callback
+                FromESN.search {uid: post.id + "@google_to_" + me}, callback
               (result, callback) ->
                 return if result.length isnt 0
                 ti = new Date().getTime() - interval
@@ -154,7 +154,7 @@
           callback null,users
         (users, callback) ->
           #EdgeControl.removeEdges(me,'@google')
-          async.each users.items, ((user,cb) ->
+          async.eachLimit 10, users.items, ((user,cb) ->
             if user.id?
               friends.push(user.id)
               #Routes.updateUserDB(user.id+'@google',user.displayName,user.displayName,user.url,user.image.url)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)