mirror of
https://github.com/amark/gun.git
synced 2025-06-22 14:02:33 +00:00
does puff help?
This commit is contained in:
parent
3953c17130
commit
1f0d0d62b0
15
gun.js
15
gun.js
@ -1954,6 +1954,7 @@
|
|||||||
|
|
||||||
;USE(function(module){
|
;USE(function(module){
|
||||||
var Type = USE('../type');
|
var Type = USE('../type');
|
||||||
|
var puff = (typeof setImmediate !== "undefined")? setImmediate : setTimeout;
|
||||||
|
|
||||||
function Mesh(root){
|
function Mesh(root){
|
||||||
var mesh = function(){};
|
var mesh = function(){};
|
||||||
@ -1972,10 +1973,16 @@
|
|||||||
if('[' === tmp){
|
if('[' === tmp){
|
||||||
try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
|
try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
|
||||||
if(!msg){ return }
|
if(!msg){ return }
|
||||||
var i = 0, m;
|
(function go(){
|
||||||
while(m = msg[i++]){
|
var S = +new Date; // STATS!
|
||||||
mesh.hear(m, peer);
|
var m, c = 100; // hardcoded for now?
|
||||||
}
|
while(c-- && (m = msg.shift())){
|
||||||
|
mesh.hear(m, peer);
|
||||||
|
}
|
||||||
|
(mesh.hear.long || (mesh.hear.long = [])).push(+new Date - S);
|
||||||
|
if(!msg.length){ return }
|
||||||
|
puff(go, 0);
|
||||||
|
}());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if('{' === tmp || (Type.obj.is(raw) && (msg = raw))){
|
if('{' === tmp || (Type.obj.is(raw) && (msg = raw))){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user