mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
default NodeJS to superpeer!
This commit is contained in:
parent
102731a710
commit
7e5fd2e398
7
gun.js
7
gun.js
@ -748,8 +748,11 @@
|
||||
function merge(node, soul){
|
||||
var ctx = this, cat = ctx.gun._, at = (cat.next || empty)[soul];
|
||||
if(!at){
|
||||
ctx.souls[soul] = false;
|
||||
return
|
||||
if(!(cat.opt||empty).super){
|
||||
ctx.souls[soul] = false;
|
||||
return;
|
||||
}
|
||||
at = (ctx.gun.get(soul)._);
|
||||
}
|
||||
var msg = ctx.map[soul] = {
|
||||
put: node,
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
ev.max = parseFloat(root.opt.memory || process.env.WEB_MEMORY || 512) * 0.8;
|
||||
|
||||
setInterval(check, 250);
|
||||
setInterval(check, 1000);
|
||||
function check(){
|
||||
var used = ev.used = util().heapTotal / 1024 / 1024;
|
||||
if(used < ev.max){ return }
|
||||
@ -19,7 +19,7 @@
|
||||
}
|
||||
function GC(){
|
||||
var souls = Object.keys(root.graph||empty);
|
||||
var toss = Math.ceil(souls.length * 0.1);
|
||||
var toss = Math.ceil(souls.length * 0.01);
|
||||
//var start = Gun.state(), i = toss;
|
||||
Gun.list.map(souls, function(soul){
|
||||
if(--toss < 0){ return }
|
||||
|
@ -1,6 +1,12 @@
|
||||
;(function(){
|
||||
var Gun = require('../gun');
|
||||
var Gun = require('../gun'), u;
|
||||
Gun.serve = require('./serve');
|
||||
Gun.on('opt', function(root){
|
||||
this.to.next(root);
|
||||
if(root.once){ return }
|
||||
if(u !== root.opt.super){ return }
|
||||
root.opt.super = true;
|
||||
})
|
||||
require('../nts');
|
||||
require('./store');
|
||||
require('./rs3');
|
||||
|
Loading…
x
Reference in New Issue
Block a user