Merge branch 'main' into testing
This commit is contained in:
commit
8ee68c1109
1 changed files with 6 additions and 5 deletions
|
|
@ -313,7 +313,7 @@ public class StatusUpdater extends VmDefUpdater {
|
||||||
}
|
}
|
||||||
lastRamChange = now;
|
lastRamChange = now;
|
||||||
lastRamValue = event.size();
|
lastRamValue = event.size();
|
||||||
updateRam(lastRamValue);
|
updateRam();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -323,10 +323,11 @@ public class StatusUpdater extends VmDefUpdater {
|
||||||
if (balloonTimer != null) {
|
if (balloonTimer != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final var pipeline = activeEventPipeline();
|
||||||
balloonTimer = Components.schedule(t -> {
|
balloonTimer = Components.schedule(t -> {
|
||||||
activeEventPipeline().submit("Update RAM size", () -> {
|
pipeline.submit("Update RAM size", () -> {
|
||||||
try {
|
try {
|
||||||
updateRam(lastRamValue);
|
updateRam();
|
||||||
} catch (ApiException e) {
|
} catch (ApiException e) {
|
||||||
logger.log(Level.WARNING, e,
|
logger.log(Level.WARNING, e,
|
||||||
() -> "Failed to update ram size: " + e.getMessage());
|
() -> "Failed to update ram size: " + e.getMessage());
|
||||||
|
|
@ -336,11 +337,11 @@ public class StatusUpdater extends VmDefUpdater {
|
||||||
}, now.plusSeconds(15));
|
}, now.plusSeconds(15));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRam(BigInteger size) throws ApiException {
|
private void updateRam() throws ApiException {
|
||||||
vmStub.updateStatus(from -> {
|
vmStub.updateStatus(from -> {
|
||||||
JsonObject status = from.statusJson();
|
JsonObject status = from.statusJson();
|
||||||
status.addProperty(Status.RAM,
|
status.addProperty(Status.RAM,
|
||||||
new Quantity(new BigDecimal(size), Format.BINARY_SI)
|
new Quantity(new BigDecimal(lastRamValue), Format.BINARY_SI)
|
||||||
.toSuffixedString());
|
.toSuffixedString());
|
||||||
return status;
|
return status;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue