diff --git a/lib/radisk.js b/lib/radisk.js index 376b07ea..2e0b6a24 100644 --- a/lib/radisk.js +++ b/lib/radisk.js @@ -236,17 +236,22 @@ // if a node is requested and some of it is cached... the other parts might not be. //} } + o.span = (u !== o.start) || (u !== o.end); var g = function Get(){}; g.lex = function(file){ var tmp; file = (u === file)? u : decodeURIComponent(file); tmp = o.next || key || (o.reverse? o.end || '\uffff' : o.start || ''); if(!file || (o.reverse? file < tmp : file > tmp)){ - if(o.next){ g.file = file } + if(o.next || o.reverse){ g.file = file } if(tmp = Q[g.file]){ tmp.push({key: key, ack: cb, file: g.file, opt: o}); return true; } Q[g.file] = [{key: key, ack: cb, file: g.file, opt: o}]; + if(!g.file){ + g.it(null, u, {}); + return true; + } r.parse(g.file, g.it); return true; } @@ -267,8 +272,10 @@ if(!o.some){ o.some = (u !== data) } if(u !== data){ as.ack(g.err, data, o) } else if(!as.file){ !o.some && as.ack(g.err, u, o); return } - if(/*!last || */last === tmp){ !o.some && as.ack(g.err, u, o); return } - if(last && last > tmp && 0 != last.indexOf(tmp)){ !o.some && as.ack(g.err, u, o); return } + if(!o.span){ + if(/*!last || */last === tmp){ !o.some && as.ack(g.err, u, o); return } + if(last && last > tmp && 0 != last.indexOf(tmp)){ !o.some && as.ack(g.err, u, o); return } + } if(o.some && o.parsed >= o.limit){ return } o.next = as.file; r.read(tmp, as.ack, o); @@ -322,7 +329,6 @@ return map(q, p.ack); } } - var start; LOG && (start = (+new Date)); // keep this commented out in production! var tmp = p.split(data), pre = [], i, k, v; if(!tmp || 0 !== tmp[1]){ diff --git a/package.json b/package.json index 3aa3fbbf..3f3b34e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gun", - "version": "0.2019.422", + "version": "0.2019.423", "description": "A realtime, decentralized, offline-first, graph data synchronization engine.", "main": "index.js", "browser": "gun.js", diff --git a/test/common.js b/test/common.js index d0d23c17..0c2de5b8 100644 --- a/test/common.js +++ b/test/common.js @@ -6,6 +6,8 @@ describe('Gun', function(){ if(typeof window !== 'undefined'){ env = window } root = env.window? env.window : global; try{ env.window && root.localStorage && root.localStorage.clear() }catch(e){} + try{ localStorage.clear() }catch(e){} + try{ indexedDB.deleteDatabase('radatatest') }catch(e){} try{ require('fs').unlinkSync('data.json') }catch(e){} try{ require('../lib/fsrm')('radatatest') }catch(e){} //root.Gun = root.Gun || require('../gun');