diff src/facebook.coffee @ 22:b90e6df48d2d

eachLimit instead of each
author Mathias Gebbe <mgebbe@intevation.de>
date Mon, 16 Jun 2014 17:31:05 +0200
parents a52b5b244e51
children 08d9679da0f7
line wrap: on
line diff
--- a/src/facebook.coffee	Fri Jun 13 21:21:41 2014 +0200
+++ b/src/facebook.coffee	Mon Jun 16 17:31:05 2014 +0200
@@ -48,10 +48,10 @@
   ], (err, posts) ->
     return if not posts? or posts.length is 0
     #console.log JSON.stringify(posts) # all posts from network (100)
-    async.eachSeries posts, ((post, callback) ->
+    async.eachLimit posts, 10, ((post, callback) ->
       async.waterfall [
         (callback) ->
-          FromESN.search {uid: post.id + "@facebook_to_" + me, recipientUser: me}, callback
+          FromESN.search {uid: post.id + "@facebook_to_" + me}, callback
         (result, callback) ->
           return if result.length isnt 0 or post.from.id is id
           #console.log "postid: " + post.from.id + "id:" + id
@@ -87,6 +87,7 @@
       else
         console.log 'all posts processed'
       return
+
   ####
   # TO DO: GET NEW COMMENTS
   # for each fromESN check the comments
@@ -98,7 +99,7 @@
     (callback) ->
       FromESN.search {recipientUser: me}, callback
     (allESN, callback) ->
-      async.each allESN, ((fromesn, callback) ->
+      async.eachLimit allESN, 10, ((fromesn, callback) ->
         async.waterfall [
           (cb) ->
             if fromesn.sourcePost.indexOf('www.facebook.com') is -1
@@ -129,7 +130,6 @@
   ], (err, result) ->
     #done
 
-
   # GET PUBLIC PUMP POSTS AND POST THEM
   async.waterfall [
     (callback) ->
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)