-
Notifications
You must be signed in to change notification settings - Fork 14
feat: adds cleaner utility for orphaned resources #34
Conversation
Codecov Report
@@ Coverage Diff @@
## master #34 +/- ##
==========================================
- Coverage 98.82% 98.81% -0.01%
==========================================
Files 15 15
Lines 20493 20493
Branches 575 575
==========================================
- Hits 20253 20251 -2
- Misses 232 234 +2
Partials 8 8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple nits, thank you for doing this work 👏
samples/test/clean.js
Outdated
datasetDeletionOperations.push(deletionOp); | ||
} | ||
|
||
if (datasetDeletionOperations.length > MAXIMUM_NUMBER_OF_DELETIONS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason you're bumping into an LRO issue, I expect, is that Promise.all
will start all the work in parallel, leading to resource contention.
Instead you could just do:
for (const dataset of datasets) {
await datasetDeletionOperations(dataset)
}
And I think wouldn't need to cap the amount of cleanup you do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
🤖 I have created a release \*beep\* \*boop\* --- ## [1.2.0](https://www.github.com/googleapis/nodejs-ai-platform/compare/v1.1.0...v1.2.0) (2021-01-09) ### Features * adds cleaner utility for orphaned resources ([#34](https://www.github.com/googleapis/nodejs-ai-platform/issues/34)) ([7c09258](https://www.github.com/googleapis/nodejs-ai-platform/commit/7c09258eb99d9c40ba7bf28b6d84434d6bb8a5b9)) * adds style enumeration ([#37](https://www.github.com/googleapis/nodejs-ai-platform/issues/37)) ([81c1515](https://www.github.com/googleapis/nodejs-ai-platform/commit/81c15150f55c4ef20359c1e48530f2c9bcd0f64b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This PR adds the clean.js script to clean up old, stale, or orphaned resources greater than 2 days old. It deletes the following types of resources:
Fixes #26