restore yson

This commit is contained in:
Mark Nadal 2020-09-19 20:55:00 -07:00
parent eea79db456
commit 93accb159c
3 changed files with 4 additions and 4 deletions

2
gun.js
View File

@ -1156,7 +1156,7 @@
var stat = console.STAT || {};
console.log('HEAR:', peer.id, (raw||'').slice(0,250), ((raw||'').length / 1024 / 1024).toFixed(4));
console.log(setTimeout.turn.s.length, 'stacks', parseFloat((-(LT - (LT = +new Date))/1000).toFixed(3)), 'sec', parseFloat(((LT-ST)/1000 / 60).toFixed(1)), 'up', stat.peers||0, 'peers', stat.has||0, 'has');
console.log(setTimeout.turn.s.length, 'stacks', parseFloat((-(LT - (LT = +new Date))/1000).toFixed(3)), 'sec', parseFloat(((LT-ST)/1000 / 60).toFixed(1)), 'up', stat.peers||0, 'peers', stat.has||0, 'has', stat.err||0, 'err');
}catch(e){ console.log('DBG err', e) }}
hear.d += raw.length||0 ; ++hear.c } // STATS!

View File

@ -61,7 +61,7 @@ Gun.on('opt', function(root){
console.STAT && console.STAT(S, +new Date - S, 'stats');
S = +new Date;
JSON.stringifyAsync(stats, function(err, raw){ if(err){ return }
fs.writeFile(__dirname+'/../stats.'+(root.opt.file||file), raw, function(err){ console.STAT && console.STAT(S, +new Date - S, 'stats stash') });
fs.writeFile(__dirname+'/../stats.'+(root.opt.file||file), raw, function(err){ err && console.log(console.STAT.err = err); console.STAT && console.STAT(S, +new Date - S, 'stats stash') });
});
stats.over = S;
stats.gap = {};

View File

@ -4,7 +4,7 @@
var yson = {}, u, sI = setTimeout.turn || (typeof setImmediate != ''+u && setImmediate) || setTimeout;
yson.parseAsync = function(text, done, revive, M){
try{done(u, JSON.parse(text, revive))}catch(e){console.log('%',e);done(e)}return;
//try{done(u, JSON.parse(text, revive))}catch(e){console.log('%',e);done(e)}return;
//console.log("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
if('string' != typeof text){ try{ done(u,JSON.parse(text)) }catch(e){ done(e) } return }
var ctx = {i: 0, text: text, done: done, l: text.length, up: []};
@ -159,7 +159,7 @@ function value(s){
}
yson.stringifyAsync = function(data, done, replacer, space, ctx){
try{done(u, JSON.stringify(data, replacer, space))}catch(e){console.log('%%',e);done(e)}return;
//try{done(u, JSON.stringify(data, replacer, space))}catch(e){console.log('%%',e);done(e)}return;
//console.log("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
ctx = ctx || {};
ctx.text = ctx.text || "";