diff --git a/gun.js b/gun.js index 2c830835..04f2df29 100644 --- a/gun.js +++ b/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, diff --git a/lib/evict.js b/lib/evict.js index 0bc91773..8b95f558 100644 --- a/lib/evict.js +++ b/lib/evict.js @@ -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 } diff --git a/lib/server.js b/lib/server.js index f46972e5..eec4ba66 100644 --- a/lib/server.js +++ b/lib/server.js @@ -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');