Skip to content

Commit

Permalink
Do not respond before the request is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoarrais committed Jun 21, 2011
1 parent 0f48e73 commit f8279a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions imagenie.coffee
Expand Up @@ -100,8 +100,9 @@ module.exports.saveImage = (albumName, input, callback) ->
orch = new Orchestra()
generateId orch.emitter('id')
identify = im.identify orch.emitter('im')
input.on 'end', orch.emitter('end')

orch.on 'id', (data) -> callback(data.id[0][1])
orch.on 'id,end', (data) -> callback(data.id[0][1])
orch.on 'id,im', (data) ->
metadata = data.im[0][1]
imgDoc =
Expand All @@ -125,7 +126,7 @@ module.exports.saveImage = (albumName, input, callback) ->
input.on 'data', (chunk) ->
imgData.write(chunk, 'binary')
identify.stdin.write(chunk, 'binary')
input.on 'end', -> identify.stdin.end()
orch.on 'end', -> identify.stdin.end()

module.exports.retrieve = (method, album, size, id, res) ->
db.getDoc id, (err, image) ->
Expand Down

0 comments on commit f8279a0

Please sign in to comment.