posts.getUpvoters - socket.io flood - user emit banned
-
Hello,
I have a problem with 0.6.x that wasn't present in 0.5.x.
I use in my theme deep-space a little script to show who have upvoted a post.
For this I use a function which basically callssocket.emit('posts.getUpvoters', pid, function(err, data) { //doing stuff here });
My problem is that I need to call it on every post and there seems to be a limit now
19/1 15:39 [3652] - warn: Flooding detected! Calls : 21, Duration : 58 19/1 15:39 [3652] - warn: [socket.io] Too many emits! Disconnecting uid : 1. Message : posts.getUpvoters [socket.io] Too many emits! Disconnecting uid : 1. Message : posts.getUpvoters
And the big issue is that I'm not able to post anymore before restarting the server which is a real problem. For now I've deactivated this but I really like this feature and was hopping to release it as a plugin sometime and with this I'm kinda stuck.
Is there any way to cheat on this ? -
getUpvoters works with array · NodeBB/NodeBB@2f955c3
Node.js based forum software built for the modern web - getUpvoters works with array · NodeBB/NodeBB@2f955c3
GitHub (github.com)
You can send an array of pids to the socket call now, so instead of making a call for every post just gather the pids you want and send them all.
socket.emit('posts.getUpvoters', [1,2,3,4], function(err, data){ console.log(data); });
-
@baris I have this one for now
21/1 14:13 [30334] - warn: [socket.io] Too many emits! Disconnecting uid : 49. Events : meta.reconnected,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.notifyTyping,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.notifyTyping,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.notifyTyping,modules.composer.renderPreview,modules.composer.renderPreview,modules.composer.notifyTyping,modules.composer.renderPreview,user.search,modules.composer.renderPreview
There's a least 3 users with the bug I'll update when I catch more.
-
Thanks looks like that user disconnected and then sent a bunch of render preview calls.
meta.reconnected, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.notifyTyping, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.notifyTyping, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.notifyTyping, modules.composer.renderPreview, modules.composer.renderPreview, modules.composer.notifyTyping, modules.composer.renderPreview, user.search, modules.composer.renderPreview
-
@baris Here's the user of yesterday
21/1 14:54 [30334] - warn: Flooding detected! Calls : 21, Duration : 959 21/1 14:54 [30334] - warn: [socket.io] Too many emits! Disconnecting uid : 2. Events : topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead,topics.loadMore,topics.markAsRead
-
socket.emit('posts.getUpvoters', [1,2,3,4], function(err, data){ console.log(data); });
Is not working when there's more than one post in the array. The data.usernames object is empty.
And I'm sure that the posts have votes because I construct the array testing if the votes attribute is equal to 0 or not.
Another question is there any avaible hook to fire my function when posts are loading inside a topic (infinite scroll). I've tested
action:topic.loading
andaction:ajaxify.end
but both gets only fired once.As for the logs of my uid 2 any idea on what's happening ?
Thanks in advance. -
@baris Thanks the
posts.getUpvoters
is fixed
Any idea on how to fire the function when new posts are loaded while scrolling ? I think some http://api.jquery.com/ajaxcomplete/ could do the trick but it's kind of ugly no ?
Also havin a hook that gives back the pids of the logged posts could be even more nice would avoid to do the ones already done. -
pass the loaded pids to action:posts.loaded · NodeBB/NodeBB@288d507
Node.js based forum software built for the modern web - pass the loaded pids to action:posts.loaded · NodeBB/NodeBB@288d507
GitHub (github.com)
You will get the loaded pids in the params of the hook with that commit.