testing ._checkIndex(..), tweaks, and cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-02-06 04:34:48 +03:00
parent 6d678abd87
commit 26650d63fe
2 changed files with 11 additions and 12 deletions

View File

@ -2746,25 +2746,29 @@ function(title, func){
return object.mixin(
action = Queued(function(items, ...args){
var that = this
var inputs = [...arguments]
// sync start...
if(arguments[0] == 'sync' || arguments[0] == 'async'){
var [sync, items, ...args] = arguments }
if(inputs[0] == 'sync' || inputs[0] == 'async'){
var [sync, [items, ...args]] = [inputs.shift(), inputs] }
// XXX see arg_handler(..) note below...
var q
var inputs = [items, ...args]
// pre-process args...
// pre-process args (sync)...
arg_handler
&& (inputs = arg_handler.call(this,
sync == 'sync' ?
sync
// XXX should this be a queue???
// ...seems like this is either 'sync' or
// undefined but never a queue at this stage...
: q,
...inputs))
// special-case: empty inputs -- no need to handle anything...
if(inputs instanceof Array
&& inputs[0]
&& inputs[0].length == 0){
&& (inputs.length == 0
|| (inputs[0] || []).length == 0)){
return Promise.resolve(inputs) }
// Define the runner and prepare...

View File

@ -858,14 +858,11 @@ var FileSystemLoaderActions = actions.Actions({
_checkIndex: ['File/Check index consistency',
// XXX technically this can be a non-session queue, but we'll
// need to save the check results...
// XXX update handlers...
// XXX update .handlers to maintain .changes via promise...
core.sessionQueueHandler('checkIndex',
function(queue, ...args){
// no index loaded...
if(!this.location.loaded){
// XXX should this throw or resolve???
//throw new Error('.checkIndex(): no index to fix.') }
// XXX test...
return [] }
// merged index...
// XXX can we remove this restriction -- i.e. check each index...
@ -873,7 +870,6 @@ var FileSystemLoaderActions = actions.Actions({
throw new Error('.checkIndex(): combined indexes not supported.') }
// get the data...
return [Object.entries(this.images), ...args] },
// XXX test...
function([gid, image], ...args){
var updated = false
// image .previews...
@ -883,7 +879,6 @@ var FileSystemLoaderActions = actions.Actions({
!fse.existsSync(image.base_path +'/'+ p[1])
&& (updated = true)
&& (delete previews[p[0]]) })
// XXX do we need this???
Object.keys(previews).length == 0
&& (delete image.preview)
// image .path...