gdpelican / babble

Discourse Shoutbox plugin
MIT License
107 stars 64 forks source link

"... is typing" message makes too many requests to backend #183

Closed SystemZ closed 8 years ago

SystemZ commented 8 years ago

Currently on beta branch each keystroke generates 1 POST to backend. This results in DoS for forum when typing message.

screenshot at 12-35-34

Chart for average CPU is much higher after upgrading plugin with this notification. Typing results 100% CPU on server for a couple of seconds or minutes if there are more people typing.

screenshot at 12-39-44

Maybe better idea will be mechanism like in Discourse search box?

gdpelican commented 8 years ago

Thanks for the report. @xfix can you add a reasonable debounce to this call? There's a handy function in discourse/lib/debounce that should fix this.

gdpelican commented 8 years ago

I've merged this into the beta branch and will deploy to discourse-babble.com. If that stands up over the next day or two, I'll merge into the master branch. Thanks for the report @SystemZ !

SystemZ commented 8 years ago

I tested it and now it's fixed. Many thanks :)