Skip to content

Conversation

bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Sep 29, 2025

// Start a backup:
var backup_1 = client.backup.create(
  "backup_1", "filesystem",
  b1 -> b1
    .includeCollections("Small", "Medium")
    .compressionLevel(CompressionLevel.BEST_COMPRESSION)
    .cpuPercentage(10)
);

System.out.println("%s is %s".formatted(backup_1.id(), backup_1.status());

// Wait for backup #1 to complete
backup_1.waitForCompletion(client);

// Start another backup:
var backup_2 = client.backup.create(
  "backup_2", "filesystem",
  b2 -> b2
    .includeCollections("Large")
    .compressionLevel(CompressionLevel.BEST_SPEED)
    .cpuPercentage(80)
);
System.out.println("%s is %s".formatted(backup_2.id(), backup_2.status());

// If backup #2 does not complete in 60s cancel it
var create_2 = client.backup.getCreateStatus(backup_2.id(), backup_2.backend());
try {
  create_2.waitForCompletion(client, wait -> wait.timeout(Duration.ofSeconds(60));
} catch (TimeoutException __) {
  create_2.cancel(client);
}

@bevzzz bevzzz self-assigned this Sep 29, 2025
Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz marked this pull request as ready for review September 30, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant