Automattic / knox

S3 Lib
MIT License
1.74k stars 285 forks source link

Callback Called Twice on .deleteMultiple #237

Closed bendytree closed 10 years ago

bendytree commented 10 years ago

deleteMultiple is firing its callback twice.

My key is also not getting deleted, but that is due to a permissions issue. I suppose the permission issue may be causing multiple callbacks.

Here's a simple example:

var knox = require('knox');
var client = knox.createClient({ ... });

client.deleteMultiple(["123456789.zip"], function(err, res){
  console.log("finished", err, !!res);
});

setTimeout(function(){console.log("let die");}, 30000);

The output looks like:

finished null true
finished { [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' } false
let die

Subscribing to res.on('data', ...) prevents the extra callback.