delete logs

This commit is contained in:
Mark Nadal 2020-01-10 06:15:05 -08:00
parent e8b5587b99
commit 08c45c08d4

18
gun.js
View File

@ -691,7 +691,6 @@
return gun; return gun;
} }
function root(msg){ function root(msg){
console.only(4, +new Date - console.S, msg['@']); console.S = +new Date;
//add to.next(at); // TODO: MISSING FEATURE!!! //add to.next(at); // TODO: MISSING FEATURE!!!
var ev = this, as = ev.as, at = as.at || as, gun = at.$, dup, tmp; var ev = this, as = ev.as, at = as.at || as, gun = at.$, dup, tmp;
if(!(tmp = msg['#'])){ tmp = msg['#'] = text_rand(9) } if(!(tmp = msg['#'])){ tmp = msg['#'] = text_rand(9) }
@ -702,24 +701,19 @@
} }
return; return;
} }
console.only(5, msg['@']);
dup.track(tmp); dup.track(tmp);
if(!at.ask(msg['@'], msg)){ if(!at.ask(msg['@'], msg)){
if(msg.get){ if(msg.get){
Gun.on.get(msg, gun); //at.on('get', get(msg)); Gun.on.get(msg, gun); //at.on('get', get(msg));
} }
if(msg.put){ if(msg.put){
console.only(6, msg['@']); var S = console.S = +new Date;
Gun.on.put(msg, gun); //at.on('put', put(msg)); Gun.on.put(msg, gun); //at.on('put', put(msg));
console.only(7, msg['@'], '??', +new Date - console.S, 'total', +new Date - S); console.S = +new Date;
} }
} }
ev.to.next(msg); ev.to.next(msg);
console.only(8, msg['@'], +new Date - console.S); console.S = +new Date;
if(!as.out){ if(!as.out){
msg.out = root; msg.out = root;
at.on('out', msg); at.on('out', msg);
console.only(12, msg['@'], +new Date - console.S); console.S = +new Date;
} }
} }
}()); }());
@ -729,12 +723,9 @@
var at = gun._, ctx = {$: gun, graph: at.graph, put: {}, map: {}, souls: {}, machine: Gun.state(), ack: msg['@'], cat: at, stop: {}}; var at = gun._, ctx = {$: gun, graph: at.graph, put: {}, map: {}, souls: {}, machine: Gun.state(), ack: msg['@'], cat: at, stop: {}};
if(!Gun.obj.map(msg.put, perf, ctx)){ return } // HNPERF: performance test, not core code, do not port. if(!Gun.obj.map(msg.put, perf, ctx)){ return } // HNPERF: performance test, not core code, do not port.
if(!Gun.graph.is(msg.put, null, verify, ctx)){ ctx.err = "Error: Invalid graph!" } if(!Gun.graph.is(msg.put, null, verify, ctx)){ ctx.err = "Error: Invalid graph!" }
console.only(7, ctx.ack, 'after graph check', +new Date - console.S, 'WHAT?', Object.keys(ctx.diff||{}).length, Object.keys(ctx.put||{}).length, Object.keys(ctx.souls||{}).length); console.S = +new Date;
if(ctx.err){ return at.on('in', {'@': msg['#'], err: Gun.log(ctx.err) }) } if(ctx.err){ return at.on('in', {'@': msg['#'], err: Gun.log(ctx.err) }) }
obj_map(ctx.put, merge, ctx); obj_map(ctx.put, merge, ctx);
console.only(8, msg['@'], 'after merge', +new Date - console.S, ctx.async); console.S = +new Date;
if(!ctx.async){ obj_map(ctx.map, map, ctx) } if(!ctx.async){ obj_map(ctx.map, map, ctx) }
console.only(9, msg['@'], 'after map', +new Date - console.S); console.S = +new Date;
if(u !== ctx.defer){ if(u !== ctx.defer){
setTimeout(function(){ setTimeout(function(){
Gun.on.put(msg, gun); Gun.on.put(msg, gun);
@ -815,7 +806,6 @@
var next = root.next || (root.next = {}), at = next[soul]; var next = root.next || (root.next = {}), at = next[soul];
// queue concurrent GETs? // queue concurrent GETs?
if(!node){ return root.on('get', msg) } if(!node){ return root.on('get', msg) }
console.only(2, 'GET', soul, Object.keys(node||{}).length); console.S = +new Date;
if(has){ if(has){
if('string' != typeof has || !obj_has(node, has)){ return root.on('get', msg) } if('string' != typeof has || !obj_has(node, has)){ return root.on('get', msg) }
node = Gun.state.to(node, has); node = Gun.state.to(node, has);
@ -827,8 +817,6 @@
} }
node = Gun.graph.node(node); node = Gun.graph.node(node);
tmp = (at||empty).ack; tmp = (at||empty).ack;
console.only(3, 'GET..a', soul, +new Date - console.S); var S = console.S = +new Date; // VVVVVVVVVVVVVVVVVVVVV SLOWEST CODE SO FAR
// SECURITY IS TAKING 0.6 ~ 1sec
root.on('in', { root.on('in', {
'@': msg['#'], '@': msg['#'],
how: 'mem', how: 'mem',
@ -836,7 +824,6 @@
$: gun, $: gun,
_: faith // HNPERF: see disclaimer below _: faith // HNPERF: see disclaimer below
}); });
console.only(15, 'GET....b<<', soul, +new Date - S, +new Date - console.S); console.S = +new Date;
//if(0 < tmp){ return } //if(0 < tmp){ return }
root.on('get', msg); root.on('get', msg);
} }
@ -2022,8 +2009,6 @@
return; return;
} }
var S; LOG && (S = +new Date); var S; LOG && (S = +new Date);
console.only(); if(msg.get){ console.only.i=1}
console.only(1, msg.get); console.S = +new Date;
root.on('in', msg); root.on('in', msg);
LOG && !msg.nts && opt.log(S, +new Date - S, 'msg', msg['#']); LOG && !msg.nts && opt.log(S, +new Date - S, 'msg', msg['#']);
return; return;
@ -2043,10 +2028,8 @@
var meta = msg._||(msg._=function(){}); var meta = msg._||(msg._=function(){});
if(!(id = msg['#'])){ id = msg['#'] = Type.text.random(9) } if(!(id = msg['#'])){ id = msg['#'] = Type.text.random(9) }
if(!(hash = msg['##']) && u !== msg.put){ hash = msg['##'] = Type.obj.hash(msg.put) } if(!(hash = msg['##']) && u !== msg.put){ hash = msg['##'] = Type.obj.hash(msg.put) }
console.only(9, msg['@'], +new Date - console.S); console.S = +new Date;
if(!(raw = meta.raw)){ if(!(raw = meta.raw)){
raw = meta.raw = mesh.raw(msg); raw = meta.raw = mesh.raw(msg);
console.only(10, msg['@'], +new Date - console.S); console.S = +new Date;
if(hash && (tmp = msg['@'])){ if(hash && (tmp = msg['@'])){
dup.track(tmp+hash).it = msg; dup.track(tmp+hash).it = msg;
if(tmp = (dup.s[tmp]||ok).it){ if(tmp = (dup.s[tmp]||ok).it){
@ -2081,7 +2064,6 @@
} }
peer.batch = []; // peer.batch = '['; // TODO: Prevent double JSON! peer.batch = []; // peer.batch = '['; // TODO: Prevent double JSON!
setTimeout(function(){flush(peer)}, opt.gap); setTimeout(function(){flush(peer)}, opt.gap);
console.only(11, msg['@'], '>>', +new Date - console.S); console.S = +new Date;
send(raw, peer); send(raw, peer);
} }
function flush(peer){ function flush(peer){