Skip to content

Commit

Permalink
adding some more logging to clean buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-munro committed Jun 7, 2024
1 parent 7a8653f commit dc9e890
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ public static void cleanBuckets(final Storage storage, final long olderThan, lon
new Runnable() {
@Override
public void run() {
log.info("Running clean buckets..");
Page<Bucket> buckets =
storage.list(
Storage.BucketListOption.prefix(BUCKET_NAME_PREFIX),
Storage.BucketListOption.userProject(storage.getOptions().getProjectId()));
for (Bucket bucket : buckets.iterateAll()) {
if (bucket.getCreateTime() < olderThan) {
try {
log.info("Cleaning up Bucket.." + bucket.getName());
for (Blob blob :
bucket
.list(
Expand All @@ -99,8 +101,8 @@ public void run() {
}
forceDelete(storage, bucket.getName());
} catch (Exception e) {
log.warning("Caught exception when attempting to clean up buckets "
+ e.getMessage());
log.warning(
"Caught exception when attempting to clean up buckets " + e.getMessage());
}
}
}
Expand Down Expand Up @@ -299,6 +301,7 @@ public Boolean call() {
}
return true;
} catch (StorageException e) {
log.warning("Caught exception in Delete Bucket Task" + e.getMessage());
if (e.getCode() == 409) {
try {
Thread.sleep(500);
Expand Down

0 comments on commit dc9e890

Please sign in to comment.