diff --git a/src/table.js b/src/table.js index 33c15b94c..2bab42fd6 100644 --- a/src/table.js +++ b/src/table.js @@ -1136,8 +1136,8 @@ Table.prototype.mutate = function(entries, gaxOptions, callback) { var entryToIndex = new Map(entries.map((entry, index) => [entry, index])); var mutationErrorsByEntryIndex = new Map(); - function onBatchResponse(previousNumRequestsMade, err) { - if (previousNumRequestsMade === numRequestsMade && err) { + function onBatchResponse(err) { + if (err) { // The error happened before a request was even made, don't retry. callback(err); return; @@ -1180,7 +1180,7 @@ Table.prototype.mutate = function(entries, gaxOptions, callback) { retryOpts: retryOpts, }) .on('request', () => numRequestsMade++) - .on('error', onBatchResponse.bind(null, numRequestsMade)) + .on('error', onBatchResponse) .on('data', function(obj) { obj.entries.forEach(function(entry) { var originalEntry = entryBatch[entry.index]; diff --git a/system-test/mutate-rows.js b/system-test/mutate-rows.js index 38c9974db..e86c352a2 100644 --- a/system-test/mutate-rows.js +++ b/system-test/mutate-rows.js @@ -53,7 +53,6 @@ describe('Bigtable/Table', () => { }, }; bigtable.grpcCredentials = grpc.credentials.createInsecure(); - bigtable.projectId = 'test'; const INSTANCE = bigtable.instance('instance'); const TABLE = INSTANCE.table('table'); diff --git a/test/table.js b/test/table.js index 20f5aa3f1..3a55baccb 100644 --- a/test/table.js +++ b/test/table.js @@ -1733,28 +1733,6 @@ describe('Bigtable/Table', function() { done(); }); }); - - it('should not retry a pre request error', function(done) { - var calls = 0; - var error = new Error('err'); - table.requestStream = function() { - calls++; - var stream = new Stream({ - objectMode: true, - }); - - setImmediate(function() { - stream.emit('error', error); - }); - - return stream; - }; - table.mutate(entries, function(err) { - assert.strictEqual(calls, 1); - assert.strictEqual(err, error); - done(); - }); - }); }); });