Prevent updater race conditions.
This commit is contained in:
parent
537913542a
commit
ba5e9c402c
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.1.9 - 2013-05-05
|
||||
* 4chan X - Version 1.1.9 - 2013-05-06
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
||||
// ==/UserScript==
|
||||
/*
|
||||
* 4chan X - Version 1.1.9 - 2013-05-05
|
||||
* 4chan X - Version 1.1.9 - 2013-05-06
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -6885,10 +6885,19 @@
|
||||
return setTimeout(ThreadUpdater.update, 1000);
|
||||
}
|
||||
},
|
||||
checkpost: function() {
|
||||
checkpost: function(e) {
|
||||
if (!ThreadUpdater.checkPostCount) {
|
||||
if (e.detail.threadID !== ThreadUpdater.thread.ID) {
|
||||
return;
|
||||
}
|
||||
ThreadUpdater.seconds = 0;
|
||||
ThreadUpdater.outdateCount = 0;
|
||||
ThreadUpdater.set('timer', '...');
|
||||
}
|
||||
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 5)) {
|
||||
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND);
|
||||
}
|
||||
ThreadUpdater.set('timer', ThreadUpdater.getInterval());
|
||||
ThreadUpdater.checkPostCount = 0;
|
||||
delete ThreadUpdater.foundPost;
|
||||
return delete ThreadUpdater.postID;
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
||||
// ==/UserScript==
|
||||
/*
|
||||
* 4chan X - Version 1.1.9 - 2013-05-05
|
||||
* 4chan X - Version 1.1.9 - 2013-05-06
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -6906,10 +6906,19 @@
|
||||
return setTimeout(ThreadUpdater.update, 1000);
|
||||
}
|
||||
},
|
||||
checkpost: function() {
|
||||
checkpost: function(e) {
|
||||
if (!ThreadUpdater.checkPostCount) {
|
||||
if (e.detail.threadID !== ThreadUpdater.thread.ID) {
|
||||
return;
|
||||
}
|
||||
ThreadUpdater.seconds = 0;
|
||||
ThreadUpdater.outdateCount = 0;
|
||||
ThreadUpdater.set('timer', '...');
|
||||
}
|
||||
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 5)) {
|
||||
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND);
|
||||
}
|
||||
ThreadUpdater.set('timer', ThreadUpdater.getInterval());
|
||||
ThreadUpdater.checkPostCount = 0;
|
||||
delete ThreadUpdater.foundPost;
|
||||
return delete ThreadUpdater.postID;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.1.9 - 2013-05-05
|
||||
* 4chan X - Version 1.1.9 - 2013-05-06
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -6885,10 +6885,19 @@
|
||||
return setTimeout(ThreadUpdater.update, 1000);
|
||||
}
|
||||
},
|
||||
checkpost: function() {
|
||||
checkpost: function(e) {
|
||||
if (!ThreadUpdater.checkPostCount) {
|
||||
if (e.detail.threadID !== ThreadUpdater.thread.ID) {
|
||||
return;
|
||||
}
|
||||
ThreadUpdater.seconds = 0;
|
||||
ThreadUpdater.outdateCount = 0;
|
||||
ThreadUpdater.set('timer', '...');
|
||||
}
|
||||
if (!(g.DEAD || ThreadUpdater.foundPost || ThreadUpdater.checkPostCount >= 5)) {
|
||||
return setTimeout(ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND);
|
||||
}
|
||||
ThreadUpdater.set('timer', ThreadUpdater.getInterval());
|
||||
ThreadUpdater.checkPostCount = 0;
|
||||
delete ThreadUpdater.foundPost;
|
||||
return delete ThreadUpdater.postID;
|
||||
|
||||
@ -96,9 +96,15 @@ ThreadUpdater =
|
||||
return unless e.detail.threadID is ThreadUpdater.thread.ID
|
||||
ThreadUpdater.outdateCount = 0
|
||||
setTimeout ThreadUpdater.update, 1000 if ThreadUpdater.seconds > 2
|
||||
checkpost: ->
|
||||
checkpost: (e) ->
|
||||
unless ThreadUpdater.checkPostCount
|
||||
return unless e.detail.threadID is ThreadUpdater.thread.ID
|
||||
ThreadUpdater.seconds = 0
|
||||
ThreadUpdater.outdateCount = 0
|
||||
ThreadUpdater.set 'timer', '...'
|
||||
unless g.DEAD or ThreadUpdater.foundPost or ThreadUpdater.checkPostCount >= 5
|
||||
return setTimeout ThreadUpdater.update, ++ThreadUpdater.checkPostCount * $.SECOND
|
||||
ThreadUpdater.set 'timer', ThreadUpdater.getInterval()
|
||||
ThreadUpdater.checkPostCount = 0
|
||||
delete ThreadUpdater.foundPost
|
||||
delete ThreadUpdater.postID
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user