GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: remove bucket preconditions from deleteFiles, it is a file opera… · googleapis/google-cloud-node@675d470

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • handwritten/storage
    • src
      • bucket.ts
    • test
      • bucket.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎handwritten/storage/src/bucket.ts‎

Copy file name to clipboardExpand all lines: handwritten/storage/src/bucket.ts
+6-17Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,25 +1887,14 @@ class Bucket extends ServiceObject {
18871887

18881888
const MAX_PARALLEL_LIMIT = 10;
18891889
const errors = [] as Error[];
1890-
this.disableAutoRetryConditionallyIdempotent_(
1891-
this.methods.delete,
1892-
AvailableServiceObjectMethods.delete
1893-
);
1894-
1895-
Object.assign(query, this.instancePreconditionOpts, query);
18961890

18971891
const deleteFile = (file: File) => {
1898-
return file
1899-
.delete(query)
1900-
.catch(err => {
1901-
if (!query.force) {
1902-
throw err;
1903-
}
1904-
errors.push(err);
1905-
})
1906-
.finally(() => {
1907-
this.storage.retryOptions.autoRetry = this.instanceRetryValue;
1908-
});
1892+
return file.delete(query).catch(err => {
1893+
if (!query.force) {
1894+
throw err;
1895+
}
1896+
errors.push(err);
1897+
});
19091898
};
19101899

19111900
this.getFiles(query)
Collapse file

‎handwritten/storage/test/bucket.ts‎

Copy file name to clipboardExpand all lines: handwritten/storage/test/bucket.ts
-43Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,40 +1245,6 @@ describe('Bucket', () => {
12451245
bucket.deleteFiles(done);
12461246
});
12471247

1248-
it('should accept precondition options', done => {
1249-
const options = {
1250-
ifGenerationMatch: 100,
1251-
ifGenerationNotMatch: 101,
1252-
ifMetagenerationMatch: 102,
1253-
ifMetagenerationNotMatch: 103,
1254-
};
1255-
1256-
bucket.getFiles = (query: {}) => {
1257-
assert.deepStrictEqual(query, options);
1258-
return Promise.all([[]]);
1259-
};
1260-
1261-
bucket.deleteFiles(options, done);
1262-
});
1263-
1264-
it('should respect precondition options from constructor', done => {
1265-
bucket = new Bucket(STORAGE, BUCKET_NAME, {
1266-
preconditionOpts: {
1267-
ifGenerationMatch: 200,
1268-
ifGenerationNotMatch: 201,
1269-
ifMetagenerationMatch: 202,
1270-
ifMetagenerationNotMatch: 203,
1271-
},
1272-
});
1273-
1274-
bucket.getFiles = (query: {}) => {
1275-
assert.deepStrictEqual(query, bucket.instancePreconditionOpts);
1276-
return Promise.all([[]]);
1277-
};
1278-
1279-
bucket.deleteFiles(done);
1280-
});
1281-
12821248
it('should get files from the bucket', done => {
12831249
const query = {a: 'b', c: 'd'};
12841250

@@ -1375,15 +1341,6 @@ describe('Bucket', () => {
13751341
done();
13761342
});
13771343
});
1378-
1379-
it('should disable autoRetry when ifGenerationMatch is undefined', done => {
1380-
bucket.getFiles = () => {
1381-
assert.strictEqual(bucket.storage.retryOptions.autoRetry, false);
1382-
return Promise.resolve([[]]);
1383-
};
1384-
1385-
bucket.deleteFiles({}, done);
1386-
});
13871344
});
13881345

13891346
describe('deleteLabels', () => {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.