mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
IF email ENV CONFIG set, report slow parse
This commit is contained in:
parent
faa776a8e5
commit
958d736e0c
@ -83,12 +83,13 @@
|
||||
}
|
||||
// create a new Series for this key
|
||||
// add it into the map
|
||||
chart = Stats[key] = new SmoothieChart({responsive: true, minValue: 0, grid:{strokeStyle:'rgba(100%,100%,100%,0.2)'},labels:{fontSize:20}});
|
||||
chart = Stats[key] = new SmoothieChart({millisPerPixel:500, limitFPS: 16, responsive: true, minValue: 0, grid:{strokeStyle:'rgba(100%,100%,100%,0.2)'},labels:{fontSize:20}, grid: {verticalSections: 0, millisPerLine: 15000 * 4 /*, strokeStyle:'rgb(125, 0, 0)'*/}});
|
||||
chart.line = new TimeSeries();
|
||||
chart.addTimeSeries(chart.line,{ strokeStyle:'rgb('+Math.random()*255+', '+Math.random()*255+','+Math.random()*255+')', lineWidth:5 });
|
||||
chart.canvas = $('.model').find('.chart').clone(true).appendTo('.charts');
|
||||
chart.canvas.find('span').text(key);
|
||||
chart.streamTo(chart.canvas.find('canvas').get(0), 15 * 1000);
|
||||
chart.line.append(0, 0);
|
||||
// check first two characters of key to determine other charts to add this in
|
||||
// tbd later
|
||||
return chart;
|
||||
|
@ -16,8 +16,8 @@
|
||||
function check(){
|
||||
var used = util().rss / 1024 / 1024;
|
||||
var hused = heap().used_heap_size / 1024 / 1024;
|
||||
//if(hused < ev.max && used < ev.max){ return }
|
||||
if(used < ev.max){ return }
|
||||
if(hused < ev.max && used < ev.max){ return }
|
||||
//if(used < ev.max){ return }
|
||||
console.LOG && Gun.log('evict memory:', hused.toFixed(), used.toFixed(), ev.max.toFixed());
|
||||
GC();//setTimeout(GC, 1);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
function atomic(v){ return u !== v && (!v || 'object' != typeof v) }
|
||||
var map = Gun.obj.map;
|
||||
var LOG = console.LOG;
|
||||
var ST = 0;
|
||||
|
||||
if(!opt.store){
|
||||
return opt.log("ERROR: Radisk needs `opt.store` interface with `{get: fn, put: fn (, list: fn)}`!");
|
||||
@ -319,7 +320,7 @@
|
||||
LOG && opt.log(S, +new Date - S, 'rad read in, ack', disk.length); S = +new Date;
|
||||
var STMP = disk.length; // TMP STATS! DELETE!
|
||||
map(disk, g.ack);
|
||||
LOG && opt.log(S, +new Date - S, 'rad read acked', STMP, JSON.stringify(g.file));
|
||||
LOG && opt.log(S, +new Date - S, 'rad read acked', STMP, JSON.stringify(g.file)); // this grows before spike?
|
||||
}
|
||||
g.ack = function(as){
|
||||
if(!as.ack){ return }
|
||||
@ -431,8 +432,9 @@
|
||||
try{
|
||||
var json = JSON.parse(data); // TODO: this caused a out-of-memory crash!
|
||||
p.disk.$ = json;
|
||||
LOG && opt.log(S, +new Date - S, 'rad parsed JSON');
|
||||
LOG && opt.log(S, ST = +new Date - S, 'rad parsed JSON');
|
||||
map(q, p.ack);
|
||||
LOG && (ST > 500) && require('./email').send({text: ""+ST+"ms "+file, from: "mark@gun.eco", to: "mark@gun.eco", subject: "RAD JSON parse"}, noop); // this is ONLY turned on if ENV CONFIGS have email/password to send out from.
|
||||
return;
|
||||
}catch(e){ tmp = e }
|
||||
if('{' === data[0]){
|
||||
|
@ -51,7 +51,7 @@
|
||||
return radix;
|
||||
};
|
||||
|
||||
Radix.map = function map(radix, cb, opt, pre){ pre = pre || [];
|
||||
Radix.map = function map(radix, cb, opt, pre){ pre = pre || []; // TODO: BUG: most out-of-memory crashes come from here.
|
||||
var t = ('function' == typeof radix)? radix.$ || {} : radix;
|
||||
if(!t){ return }
|
||||
var keys = (t[_]||no).sort || (t[_] = function $(){ $.sort = Object.keys(t).sort(); return $ }()).sort, rev;
|
||||
|
Loading…
x
Reference in New Issue
Block a user