diff --git a/package.json b/package.json index 023b9fa5..26c80723 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gun", - "version": "0.9.997", + "version": "0.9.998", "description": "A realtime, decentralized, offline-first, graph data synchronization engine.", "main": "index.js", "browser": "gun.min.js", diff --git a/sea.js b/sea.js index ffb4f194..6d5c8b35 100644 --- a/sea.js +++ b/sea.js @@ -741,10 +741,9 @@ })(USE, './authenticate'); ;USE(function(module){ - // TODO: BUG! `SEA` needs to be USED! - const Gun = (typeof window !== 'undefined' ? window : global).Gun || USE('gun/gun') const authsettings = USE('./settings') const SEA = USE('./sea'); + const Gun = SEA.Gun; //const { scope: seaIndexedDb } = USE('./indexed') // This updates sessionStorage & IndexedDB to persist authenticated "session" const updateStorage = (proof, key, pin) => async (props) => { @@ -790,7 +789,8 @@ })(USE, './update'); ;USE(function(module){ - const Gun = (typeof window !== 'undefined' ? window : global).Gun || USE('gun/gun') + const SEA = USE('./sea'); + const Gun = SEA.Gun; const Buffer = USE('./buffer') const authsettings = USE('./settings') const updateStorage = USE('./update') @@ -857,9 +857,6 @@ })(USE, './login'); ;USE(function(module){ - // TODO: BUG! `SEA` needs to be USEd! - const Gun = (typeof window !== 'undefined' ? window : global).Gun || USE('gun/gun') - const Buffer = USE('./buffer') const authsettings = USE('./settings') //const { scope: seaIndexedDb } = USE('./indexed') @@ -867,6 +864,7 @@ const parseProps = USE('./parse') const updateStorage = USE('./update') const SEA = USE('./sea') + const Gun = SEA.Gun; const finalizeLogin = USE('./login') // This internal func recalls persisted User authentication if so configured @@ -1347,8 +1345,8 @@ })(USE, './create'); ;USE(function(module){ - const Gun = (typeof window !== 'undefined' ? window : global).Gun || USE('gun/gun') const SEA = USE('./sea') + const Gun = SEA.Gun; // After we have a GUN extension to make user registration/login easy, we then need to handle everything else. // We do this with a GUN adapter, we first listen to when a gun instance is created (and when its options change) diff --git a/test/panic/radisk.js b/test/panic/radisk.js index 2bad2780..c2635b6e 100644 --- a/test/panic/radisk.js +++ b/test/panic/radisk.js @@ -3,8 +3,8 @@ var config = { port: 8080, servers: 2, browsers: 2, - each: 10000000, - burst: 12000, + each: 25000, + burst: 50, wait: 1, dir: __dirname, route: { @@ -67,7 +67,7 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){ res.end("I am "+ env.i +"!"); }); var Gun = require('gun'); - require('gun/lib/store'); + //require('gun/lib/store'); var gun = Gun({web: server, localStorage: false, until: 6000}); server.listen(port, function(){ test.done(); @@ -108,6 +108,9 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){ if(c < l){ return } setTimeout(function(){ test.done(); + setTimeout(function(){ + location = 'http://asdf'; + }, 1500) }, 1000); }); } @@ -122,7 +125,12 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){ it("Shut server down!", function(){ return server.run(function(test){ - process.exit(); + test.async(); + console.log("giving server 20seconds to cool down..."); + setTimeout(function(){ + process.exit(); + test.done(); + }, 20 * 1000); }); }); @@ -145,8 +153,8 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){ res.end("I am "+ env.i +"!"); }); var Gun = require('gun'); - require('gun/lib/store'); - var gun = Gun({web: server, localStorage: false, thrash: 6000}); + //require('gun/lib/store'); + var gun = Gun({web: server, localStorage: false, until: 6000}); server.listen(port, function(){ test.done(); }); @@ -156,8 +164,6 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){ it("Bob read data", function(){ return bob.run(function(test){ test.async(); - test.done(); - return;asdf; console.log("I AM BOB"); localStorage.clear(); var env = test.props; @@ -168,13 +174,17 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){ var raw = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" function check(i){ + if(i > l){ + return; + } var d; var ref = window.gun.get('asdf' + i); ref.on(function(data){ if((raw+i) !== data.hello){ return test.fail('wrong ' + i) } if(d){ return } d = true; - !(i % b) && console.log(i+'/'+l);//, '@'+Math.floor(b/((-n + (n = Gun.time.is()))/1000))+'/sec')); - c++; + //!(c % b) && + console.log(c+'/'+l);//, '@'+Math.floor(b/((-n + (n = Gun.time.is()))/1000))+'/sec')); + window.GOT = c++; //localStorage.clear(); ref.off(); //console.log("gl:", Object.keys(window.gun._.graph).length); @@ -184,6 +194,9 @@ describe("Make sure the Radix Storage Engine (RSE) works.", function(){ }); } function burst(){ + if(i > l){ + return; + } for(var j = 0; j <= b; j++){ check(++i); }