Fix incorrect comparison in archive usage metric
This commit is contained in:
parent
323bfd9a6e
commit
e934ead85c
|
@ -198,13 +198,13 @@ public class BackupManager {
|
||||||
return this.remoteStorageManager.calculateBytesUsed(mediaPrefix)
|
return this.remoteStorageManager.calculateBytesUsed(mediaPrefix)
|
||||||
.thenCompose(usage -> backupsDb
|
.thenCompose(usage -> backupsDb
|
||||||
.setMediaUsage(backupUser, usage)
|
.setMediaUsage(backupUser, usage)
|
||||||
.thenApply(ignored -> usage.bytesUsed()))
|
.thenApply(ignored -> usage))
|
||||||
.whenComplete((newUsage, throwable) -> {
|
.whenComplete((newUsage, throwable) -> {
|
||||||
boolean usageChanged = throwable == null && !newUsage.equals(info.usageInfo());
|
boolean usageChanged = throwable == null && !newUsage.equals(info.usageInfo());
|
||||||
Metrics.counter(USAGE_RECALCULATION_COUNTER_NAME, "usageChanged", String.valueOf(usageChanged))
|
Metrics.counter(USAGE_RECALCULATION_COUNTER_NAME, "usageChanged", String.valueOf(usageChanged))
|
||||||
.increment();
|
.increment();
|
||||||
})
|
})
|
||||||
.thenApply(usedSpace -> MAX_TOTAL_BACKUP_MEDIA_BYTES - usedSpace >= mediaLength);
|
.thenApply(newUsage -> MAX_TOTAL_BACKUP_MEDIA_BYTES - newUsage.bytesUsed() >= mediaLength);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,9 +234,9 @@ public class ArchiveController {
|
||||||
int cdn,
|
int cdn,
|
||||||
|
|
||||||
@Schema(description = """
|
@Schema(description = """
|
||||||
If present, the directory of your backup data on the cdn. The message backup can be found at /backupDir/backupName
|
If present, the directory of your backup data on the cdn. The message backup can be found at /backupDir/backupName
|
||||||
and stored media can be found at /backupDir/media/mediaId.
|
and stored media can be found at /backupDir/media/mediaId.
|
||||||
""")
|
""")
|
||||||
String backupDir,
|
String backupDir,
|
||||||
|
|
||||||
@Schema(description = "If present, the name of the most recent message backup on the cdn. The backup is at /backupDir/backupName")
|
@Schema(description = "If present, the name of the most recent message backup on the cdn. The backup is at /backupDir/backupName")
|
||||||
|
@ -642,6 +642,7 @@ public class ArchiveController {
|
||||||
String cursor) {}
|
String cursor) {}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("/media")
|
@Path("/media")
|
||||||
@Operation(summary = "List media objects",
|
@Operation(summary = "List media objects",
|
||||||
|
|
Loading…
Reference in New Issue