Hello Themeco,
We have dedicated resources and quite a powerful hosting for mere WordPress sites and it goes down when CornerStone is used for text fields.
CornerStone triggers admin-ajax.php for each character typed or removed. Copy pasting content is fine, but manually typing it blows up the server.
Hopefully you can zoom in:
In the second screenshot, we deleted a few words and many of admin-ajax.php calls were sent. If we have 8 users typing text at the same time in different pages, the server fails with a 503 error.
Can we do anything to add a JavaScript timeout? So that every character typed or removed resets the timer after which it triggers the call only once to admin-ajax.php after the user stopped typing for 1 second?
Something similar to this would work:
// Setup before functions
var typingTimer; // Timer identifier
var doneTypingInterval = 5000; // Time in ms, 5 seconds for example
var $input = $('#myInput');
// On keyup, start the countdown
$input.on('keyup', function () {
clearTimeout(typingTimer);
typingTimer = setTimeout(doneTyping, doneTypingInterval);
});
// On keydown, clear the countdown
$input.on('keydown', function () {
clearTimeout(typingTimer);
});
// User is "finished typing," do something
function doneTyping () {
// Do something
}
Thank you for your help!