mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
fixed a race condition in .exportIndex(..)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3076044ccf
commit
46aa45593c
@ -1688,6 +1688,8 @@ progress:not(value)::-webkit-progress-bar {
|
||||
padding: 2px;
|
||||
border-radius: 5px;
|
||||
background: rgba(0,0,0,0.1);
|
||||
|
||||
z-index: 4000;
|
||||
}
|
||||
.progress-container:hover {
|
||||
background: rgba(0,0,0,0.8);
|
||||
|
||||
@ -1927,28 +1927,17 @@ var FileSystemWriterActions = actions.Actions({
|
||||
var from = (img_base || base_dir) +'/'+ preview_path
|
||||
var to = path +'/'+ preview_path
|
||||
|
||||
// XXX use queue for progress reporting...
|
||||
logger && logger.emit('queued', to)
|
||||
|
||||
// XXX do we queue these or let the OS handle it???
|
||||
// ...needs testing, if node's fs queues the io
|
||||
// internally then we do not need to bother...
|
||||
// XXX
|
||||
queue.push(ensureDir(pathlib.dirname(to))
|
||||
// XXX do we need error handling here???
|
||||
.catch(function(err){
|
||||
logger && logger.emit('error', err) })
|
||||
queue.push(copy(from, to)
|
||||
.then(function(){
|
||||
// XXX
|
||||
logger && logger.emit('queued', to)
|
||||
|
||||
return copy(from, to)
|
||||
// XXX do we need to have both of this
|
||||
// and the above .catch(..) or can
|
||||
// we just use the one above (after
|
||||
// .then(..))
|
||||
.then(function(){
|
||||
logger && logger.emit('done', to) })
|
||||
// XXX do we need error handling here???
|
||||
.catch(function(err){
|
||||
logger && logger.emit('error', err) })
|
||||
logger && logger.emit('done', to) })
|
||||
.catch(function(err){
|
||||
logger && logger.emit('error', err)
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
@ -147,14 +147,13 @@ $(function(){
|
||||
ig.logger = ig.logger || {
|
||||
root: true,
|
||||
message: null,
|
||||
log: null,
|
||||
|
||||
emit: function(e, v){
|
||||
var msg = this.message
|
||||
var log = this.log = this.log || []
|
||||
|
||||
// console...
|
||||
console.log(' '+ ((msg && msg.concat('')) || []).join(': '), e, v)
|
||||
|
||||
// progress...
|
||||
// report progress...
|
||||
// XXX HACK -- need meaningful status...
|
||||
if(e == 'queued'
|
||||
|| e == 'found'){
|
||||
@ -163,7 +162,19 @@ $(function(){
|
||||
} else if(e == 'loaded' || e == 'done' || e == 'written'
|
||||
|| e == 'skipping' || e == 'index'){
|
||||
ig.showProgress(msg || ['Progress', e], '+1')
|
||||
|
||||
// XXX STUB...
|
||||
} else if(e == 'error' ){
|
||||
ig.showProgress(['Error'].concat(msg), '+0', '+1')
|
||||
console.log(' '+ (msg || []).join(': ') + ':', e, v)
|
||||
|
||||
} else {
|
||||
// console...
|
||||
console.log(' '+ (msg || []).join(': ') + ':', e, v)
|
||||
}
|
||||
|
||||
// XXX
|
||||
//log.push([msg, e, v])
|
||||
},
|
||||
|
||||
push: function(msg){
|
||||
@ -174,6 +185,7 @@ $(function(){
|
||||
var logger = Object.create(this)
|
||||
logger.root = false
|
||||
logger.message = logger.message == null ? [msg] : logger.message.concat([msg])
|
||||
logger.log = this.log = this.log || []
|
||||
|
||||
return logger
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user