From 79fac4cb459a9bc5d610eff9ae33c154e150ad9a Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Fri, 21 Feb 2020 22:39:06 -0800 Subject: [PATCH] fix large records saving to RAD --- lib/radisk.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/radisk.js b/lib/radisk.js index 882cb66a..c1d6b9f4 100644 --- a/lib/radisk.js +++ b/lib/radisk.js @@ -200,7 +200,15 @@ try{raw = JSON.stringify(rad.$); }catch(e){ cb("Cannot radisk!"); return } console.STAT && console.STAT(S, +new Date - S, "rad stringified JSON"); - if(opt.chunk < raw.length && !o.force){ return f.split() } + if(opt.chunk < raw.length && !o.force){ + var c = 0; + Radix.map(rad, function(){ + if(c++){ return true } // more than 1 item + }); + if(c > 1){ + return f.split(); + } + } f.text = raw; f.write(); } @@ -272,7 +280,7 @@ }); }) }); - console.STAT && console.STAT(S, ST - S, "rad check"); + console.STAT && console.STAT(S, +new Date - S, "rad check"); } r.find(key, g.find); }