danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
594 stars 157 forks source link

requests are automatically sent #182

Closed ogurec-ogurec closed 4 years ago

ogurec-ogurec commented 4 years ago

I am on the post page with comments, doing nothing (I am in view mode ), but requests are automatically sent every two seconds. This is normal?

bag3

How can I make it so that requests are only sent on page reload?

danirus commented 4 years ago

Yes, it's normal. Edit the HTML template where you load the plugin. You must have something like:

<script>
 window.comments_props = {% get_commentbox_props for object %};
 window.comments_props_override = {
   allow_comments: {%if object.allow_comments%}true{%else%}false{%endif%},
   allow_feedback: true,
   show_feedback: true,
   allow_flagging: true,
   polling_interval: 2000
 };
</script>

Change the polling_interval to 0. That will make it.

ogurec-ogurec commented 4 years ago

Thank you, then I have two questions. First: what for requests being sent? Second: Will it create a load (requests) on the server with a large number of users?

Thank you in advance

danirus commented 4 years ago

The JavaScript plugin uses polling to check whether there are new comments. It's explained here in the Tutorial. Whether it creates or not a high number of requests to your server depends on how you set it up and how your visitors behaves.