diff --git a/Viewer/features/core.js b/Viewer/features/core.js index 3b46ea19..8321506e 100755 --- a/Viewer/features/core.js +++ b/Viewer/features/core.js @@ -2708,23 +2708,21 @@ function(title, func){ // be run sync... // NOTE: when chaining arg_handler(..) will get one queue per level of // chaining, but in 'sync' mode only one 'sync' is passed... +// NOTE: when calling this multiple times for the same queue each call +// will call all the stages but since items are processes async the +// later calls' later stages may end up with empty input queues, +// e.g. for: +// [1,2,3].map(e => ig.exampleChainedQueueHandler(e)) +// .exampleChainedQueueHandler(..) is called once per input and thus +// the first two stages are called sync and by the time the last +// stage of the first call is triggered (async) all the inputs are +// ready thus the first call will process all the inputs and the +// later calls will get empty inputs (unless any new inputs are while +// processing added)... // // XXX might be a good idea to split this into a generic and domain parts // and move the generic part into types/runner... // XXX check if item is already in queue... -// XXX BUG when this is called multiple times each thread is called from -// top to bottom even when consolidating the results into a single -// pack, e.g. for: -// [1,2,3].map(e => ig.exampleChainedQueueHandler(e)) -// the .exampleChainedQueueHandler(..) is called once per input and: -// - pre-prep is called once per input -// - prep is called once per input -// - action is called once per input -// ...and since the inputs are already consolidated into a -// single container this will be called on that container -// once per input -> each input is processed N times... -// ...would either need to "consume" the inputs removing them from -// the input list or keep track of what we are calling... var queueHandler = module.queueHandler = function(title, func){ @@ -2798,7 +2796,13 @@ function(title, func){ args.length > 0 && (args = [args]) q.add(items instanceof Array ? - items.map(function(e){ + items + // move the inputs out of the input array... + // NOTE: this will prevent the items from getting + // processed multiple times when the action + // is called multiple times... + .splice(0, items.length) + .map(function(e){ return [e, ...args] }) : [[items, ...args]]) return q.promise() } } diff --git a/Viewer/features/sharp.js b/Viewer/features/sharp.js index 986bf805..2c9e19ce 100755 --- a/Viewer/features/sharp.js +++ b/Viewer/features/sharp.js @@ -190,13 +190,6 @@ var SharpActions = actions.Actions({ // XXX revise return values... // XXX make backup name pattern configurable... // XXX CROP ready for crop support... - // XXX BUG? seams to create backups uncontrollably... - // to reproduce: - // ig.data.order.map(gid => ig.makeResizedImage(gid, 100, 'moo')) - // this will add each image at least twice... - // ...this might actually be an issue in .queueHandler(..), feels - // like we might be editing the array we are iterating over, - // needs more investigation... makeResizedImage: ['- Image/', core.doc`Make resized image(s)... diff --git a/Viewer/package-lock.json b/Viewer/package-lock.json index 21fffc86..f8204893 100755 --- a/Viewer/package-lock.json +++ b/Viewer/package-lock.json @@ -1211,9 +1211,9 @@ "integrity": "sha512-qxAWSFdwE0PeBh5Ws+pyX3SxJrwqratEIDrSg5odcHdUVFTzATMJImH2L8bMaDhxaQJj5ogoZc+lx56UIpXJ1g==" }, "ig-types": { - "version": "6.0.8", - "resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.8.tgz", - "integrity": "sha512-2Fd69Z/lOOTsU+algm+7BL//yDHbUYyorots9OvrF8fmDhk78T4QMZjPd7208xMG6NnuQRhmc3LbSA0yetf9pw==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.9.tgz", + "integrity": "sha512-LexsEw0tSr2dVCU9iePRdxAnXVYwQ0yrFQ2xluFwh154E2NIX6EOmPdSVJJ1c+EruWUR2ZrShy7/3p33as/trg==", "requires": { "ig-object": "^5.4.16", "object-run": "^1.0.1" diff --git a/Viewer/package.json b/Viewer/package.json index 371f3a65..256250f3 100755 --- a/Viewer/package.json +++ b/Viewer/package.json @@ -34,7 +34,7 @@ "ig-argv": "^2.16.3", "ig-features": "^3.4.7", "ig-object": "^5.4.16", - "ig-types": "^6.0.8", + "ig-types": "^6.0.9", "json5": "^2.1.3", "object-run": "^1.0.1", "requirejs": "^2.3.6",