mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
USE THIS MANHATTAN VERSION
This commit is contained in:
parent
b88a232596
commit
1e7dc317f0
@ -1,8 +1,8 @@
|
||||
;(function(){
|
||||
/*var cluster = require('cluster');
|
||||
var cluster = require('cluster');
|
||||
if(cluster.isMaster){
|
||||
return cluster.fork() && cluster.on('exit', function(){ cluster.fork(); require('../lib/crashed'); });
|
||||
}*/
|
||||
}
|
||||
|
||||
var fs = require('fs');
|
||||
var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 };
|
||||
|
3
gun.js
3
gun.js
@ -1335,7 +1335,7 @@
|
||||
hear.d += raw.length||0 ; ++hear.c } // STATS!
|
||||
var S = peer.SH = +new Date;
|
||||
var tmp = raw[0], msg;
|
||||
console.log("hear:", ((peer.wire||'').headers||'').origin, raw.slice && raw.slice(0,200)); //tc-iamunique-tc-package-ds1
|
||||
//raw && raw.slice && console.log("hear:", ((peer.wire||'').headers||'').origin, raw.length, raw.slice && raw.slice(0,50)); //tc-iamunique-tc-package-ds1
|
||||
if('[' === tmp){
|
||||
parse(raw, function(err, msg){
|
||||
if(err || !msg){ return mesh.say({dam: '!', err: "DAM JSON parse error."}, peer) }
|
||||
@ -1364,7 +1364,6 @@
|
||||
}
|
||||
}
|
||||
hear.one = function(msg, peer, S){ // S here is temporary! Undo.
|
||||
if(msg.put){ if(!msg.put['tc-iamunique-tc-package-ds1']){ return } } // isolate?
|
||||
var id, hash, tmp, ash, DBG;
|
||||
if(msg.DBG){ msg.DBG = DBG = {DBG: msg.DBG} }
|
||||
DBG && (DBG.h = S);
|
||||
|
@ -300,7 +300,7 @@
|
||||
if(!o.reverse && ((key < o.next && 0 != o.next.indexOf(key)) || (u !== o.end && (o.end || '\uffff') < o.next))){ o.more = 0 }
|
||||
if(o.reverse && ((key > o.next && 0 != key.indexOf(o.next)) || ((u !== o.start && (o.start || '') > o.next && file <= o.start)))){ o.more = 0 }
|
||||
}
|
||||
console.log(5, process.memoryUsage().heapUsed);
|
||||
//console.log(5, process.memoryUsage().heapUsed);
|
||||
if(!o.more){ cb(g.err, data, o); return }
|
||||
if(data){ cb(g.err, data, o) }
|
||||
if(o.parsed >= o.limit){ return }
|
||||
@ -313,7 +313,7 @@
|
||||
},0);
|
||||
}
|
||||
g.check = function(err, disk, info){
|
||||
console.log(4, process.memoryUsage().heapUsed);
|
||||
//console.log(4, process.memoryUsage().heapUsed);
|
||||
g.get(err, disk, info);
|
||||
if(!disk || disk.check){ return } disk.check = 1;
|
||||
var S = +new Date;
|
||||
@ -358,7 +358,7 @@
|
||||
p.read = function(err, data){ var tmp;
|
||||
DBG && (DBG.rpg = +new Date);
|
||||
console.STAT && console.STAT(S, +new Date - S, 'read disk', JSON.stringify(file), ++RPC, 'total all parses.');
|
||||
console.log(2, process.memoryUsage().heapUsed);
|
||||
//console.log(2, process.memoryUsage().heapUsed);
|
||||
if((p.err = err) || (p.not = !data)){
|
||||
delete Q[file];
|
||||
p.map(q, p.ack);
|
||||
@ -387,7 +387,7 @@
|
||||
return;
|
||||
}
|
||||
parse(data, function(err, tree){
|
||||
console.log(3, process.memoryUsage().heapUsed);
|
||||
//console.log(3, process.memoryUsage().heapUsed);
|
||||
if(!err){
|
||||
delete Q[file];
|
||||
p.disk.$ = tree;
|
||||
|
@ -51,7 +51,7 @@ function Store(opt){
|
||||
|
||||
store.put = function(file, data, cb){
|
||||
var params = {Bucket: opts.bucket, Key: file, Body: data};
|
||||
console.log("RS3 PUT ---->", (data||"").slice(0,20));
|
||||
//console.log("RS3 PUT ---->", (data||"").slice(0,20));
|
||||
c.p[file] = data;
|
||||
delete c.g[file];//Gun.obj.del(c.g, file);
|
||||
delete c.l[1];//Gun.obj.del(c.l, 1);
|
||||
@ -68,7 +68,7 @@ function Store(opt){
|
||||
//console.log("RS3 GET ---->", file);
|
||||
s3.getObject(params, function got(err, ack){
|
||||
if(err && 'NoSuchKey' === err.code){ err = u }
|
||||
console.log("RS3 GOT <----", err, file, cbs.length, ((ack||{}).Body||'').length);//.toString().slice(0,20));
|
||||
//console.log("RS3 GOT <----", err, file, cbs.length, ((ack||{}).Body||'').length);//.toString().slice(0,20));
|
||||
delete c.g[file];//Gun.obj.del(c.g, file);
|
||||
var data, data = (ack||'').Body;
|
||||
console.log(1, process.memoryUsage().heapUsed);
|
||||
|
Loading…
x
Reference in New Issue
Block a user