Fix behavior keepalive#4904
Fix behavior keepalive#4904maxvalentini77 wants to merge 7 commits intojoomla:stagingfrom maxvalentini77:fix-behavior-keepalive
Conversation
|
thanks @maxvalentini77 couple note: and can you please make something like: JFactory::getDocument()->addScriptDeclaration('
!window.setInterval(function(){
var r; try{ r = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP")}catch(e){};if(r){r.open("GET","'.$url.'",true);r.send(null)}
}, 60000);
'); |
|
Hi @Fedik Thank you |
|
I am sorry, I missed slash in my example, for url: and thanks for this, I try test tomorrow |
|
Added the slash and tested, seems to work well. |
|
test works for me good, also fix #6730 issue for me |
|
test |
|
it is ready to "RTC" or? 😃 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4904. |
|
the (at) symbol useless here 😉 |
|
Thanks for the bump and the tests @Fedik and @demis-palma RTC'ing now! This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4904. |
libraries/cms/html/behavior.php
Outdated
There was a problem hiding this comment.
Shouldn’t we repeat the call every X seconds? Where X is the option set in global config. So all I am saying is: restore this line here $script .= '},' . $refreshTime . ');'; and a few lines above $lifetime = ($config->get('lifetime') * 60000);
Right now this is fixed to a call per minute, which for some busy sites will create more load...
There was a problem hiding this comment.
With 60000 not always refresh the session if the session lifetime is set to 1 minute. Now work always well even with this very small value.
|
I notice that the session not always be refreshed if the session lifetime is set to 1 minute. I also noticed that the session lifetime can be set a zero or negative value in the configuration page. |
|
@maxvalentini77 I already use this on my sites, where default session handler is File or APC, session lifetime 1 minute I think have not much sense, not sure that we need to worry about it 😉 |
|
Thank you @maxvalentini77! Merged. |
I found three issues:
1: In some cases, call an invalid URL, resulting in a response with code 404. (still refresh the session)
2: Update the article hits counter.
3: Work in different ways with "Search Engine Friendly URLs" enabled or disabled.
How to reproduce number 1
The session is refreshed but it isn't nice to generate a 404 error that, for example, ends up in the apache logs.
How to reproduce number 2
The counter was increased by 1+X where X is the number of ajax calls.
How to reproduce number 3
This is the same procedure to reproduce number 1 but ends with a different behavior that, if the homepage display an article, generate the same issue of number 2.
(This because the homepage of the site has been called.)
Proposed solution
I modified the URL of the ajax call from "./" to:
This call refresh the session without generate any html and/or call model methods that can lead to unexpected/unwanted behaviors (for example in an increased article hits counter).
This call is available on both site and administrator applications.
To test it in the administrator application (for example) go to the edit category page that include the "behavior.keepalive" and wait for the ajax call.