prevent concurrent ajax updates

This commit is contained in:
Friendika 2010-12-15 14:41:24 -08:00
parent 83939f1541
commit df2e79dcaf
2 changed files with 8 additions and 5 deletions

8
README
View File

@ -43,11 +43,11 @@ are straight-forward and simple, because we know that relationships rarely are
(straight-forward and simple). Whether you're communicating with drinking (straight-forward and simple). Whether you're communicating with drinking
buddies or potential employers, you can rest assured that each is only able to buddies or potential employers, you can rest assured that each is only able to
see the side of you that you wish to present. If you send a private message to see the side of you that you wish to present. If you send a private message to
your aunt Mary, we encrypt it with military grade encryption. your aunt Mary, we will encrypt it with military grade encryption.
Other social network projects talk about privacy and offering a feature-rich Other distributed social network projects talk about privacy and offering a
social networking alternative, but all they can deliver is vapour and vague feature-rich social networking alternative, but all they can deliver is vapour
promises. Friendika delivers the goods. Time and time again. and vague promises. Friendika delivers the goods, time and time again.
A single instance of Friendika can easily support hundreds of (and up to A single instance of Friendika can easily support hundreds of (and up to
several thousand) people using commodity hosting hardware. Each of these several thousand) people using commodity hosting hardware. Each of these

View File

@ -25,6 +25,7 @@
var timer = null; var timer = null;
var pr = 0; var pr = 0;
var liking = 0; var liking = 0;
var in_progress = false;
$(document).ready(function() { $(document).ready(function() {
$.ajaxSetup({cache: false}); $.ajaxSetup({cache: false});
@ -87,13 +88,15 @@
function liveUpdate() { function liveUpdate() {
if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; } if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
if($('.comment-edit-text-full').length) { if(($('.comment-edit-text-full').length) || (in_progress)) {
livetime = setTimeout(liveUpdate, 10000); livetime = setTimeout(liveUpdate, 10000);
return; return;
} }
prev = 'live-' + src; prev = 'live-' + src;
in_progress = true;
$.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) { $.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) {
in_progress = false;
$('.wall-item-outside-wrapper',data).each(function() { $('.wall-item-outside-wrapper',data).each(function() {
var ident = $(this).attr('id'); var ident = $(this).attr('id');
if($('#' + ident).length == 0) { if($('#' + ident).length == 0) {