Hi guys,
I noticed that when MODX takes several seconds to parse uncached snippets, the lag time builds up when you pound on the F5 key, and eventually shows up a fatal error that the execution time exceeded 30 seconds. Apache seems to have a built-in solution to localize this for specific requesters (one tab had this showed up when the F5 key was pounded, while another tab browsing the same page was unaffected), but just in case, to avoid this and potential DDoS attacks, I modified the index.php file to check the last access time in microtime() - using existing variables:
Under line 115 or startCMSSession(); add:
if ($tstart - $_SESSION['lastFetch'] <= 1) {
//Don't continue if last access time is less than a second
die("Whoa there cowboy! You're hitting F5 too fast");
}
And just before the php closing tag:
$_SESSION['lastFetch'] = $tstart;
Welcome any test and feedback.