fixes and tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-21 05:29:17 +03:00
parent b2ba27d82f
commit 0019c77445
2 changed files with 11 additions and 7 deletions

View File

@ -2922,8 +2922,11 @@ var TaskActions = actions.Actions({
queue queue
.on('tasksAdded', function(evt, t){ .on('tasksAdded', function(evt, t){
this.logger && this.logger.emit('added'+suffix, t) }) this.logger && this.logger.emit('added'+suffix, t) })
.on('taskCompleted', function(evt, t){ // NOTE: t can be anything including an array, so to
this.logger && this.logger.emit('done'+suffix, t) }) // avoid confusion we wrap it in an array this
// one call means one emit...
.on('taskCompleted', function(evt, t, r){
this.logger && this.logger.emit('done'+suffix, [t]) })
.on('taskFailed', function(evt, t, err){ .on('taskFailed', function(evt, t, err){
this.logger && this.logger.emit('skipped'+suffix, t, err) }) this.logger && this.logger.emit('skipped'+suffix, t, err) })
.on('stop', function(){ .on('stop', function(){

View File

@ -700,6 +700,10 @@ var SharpActions = actions.Actions({
&& logger.emit('skipped', `${gid} / ${size}`) && logger.emit('skipped', `${gid} / ${size}`)
}) })) })], }) })) })],
// XXX BUG: .cacheMetadata('all'): runs out of call stack on very
// large indexes...
// ...can't yet see/find any recursion...
// .....at least the fail is fast and quiet =)
// XXX add support for offloading the processing to a thread/worker... // XXX add support for offloading the processing to a thread/worker...
// XXX revise logging and logger passing... // XXX revise logging and logger passing...
cacheMetadata: ['- Sharp|Image/', cacheMetadata: ['- Sharp|Image/',
@ -756,9 +760,7 @@ var SharpActions = actions.Actions({
// parse args... // parse args...
function(queue, image, ...args){ function(queue, image, ...args){
var that = this var that = this
var force = false var force = args[0] == 'force'
if(image === true){
var [force, image, ...args] = arguments }
// expand images... // expand images...
var images = image == 'all' ? var images = image == 'all' ?
@ -783,7 +785,6 @@ var SharpActions = actions.Actions({
return [ return [
images, images,
force,
...args, ...args,
] }, ] },
function(image, force, logger){ function(image, force, logger){
@ -908,7 +909,7 @@ module.Sharp = core.ImageGridFeatures.Feature({
// indexes... // indexes...
// XXX this needs to be run in the background... // XXX this needs to be run in the background...
// XXX this is best done in a thread // XXX this is best done in a thread
[['loadIndex' [['loadIndex',
'loadImages', 'loadImages',
'loadNewImages'], 'loadNewImages'],
'cacheMetadata: "all"'], 'cacheMetadata: "all"'],