Skip to content

Commit

Permalink
fix: Use instance updated at attribute for uptime calculation (#2378)
Browse files Browse the repository at this point in the history
## Description
An instance `created at` time is the time when it is added to the pool.
We need to use the `updated at` time which is the time when the instance
is reassigned to the user and set to running.

## Is this change user facing?
YES

## References (if applicable)
kurtosis-tech/kurtosis-cloud-backend#157
  • Loading branch information
laurentluce authored Apr 15, 2024
1 parent 2ba98f5 commit 421d275
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const InstanceTerminationWarning = () => {
const fetchCloudInstanceCreationTime = async () => {
try {
const cloudInstanceConfigResponse = await kurtosisClient.getCloudInstanceConfig();
const upTime = Math.floor((Date.now() - new Date(cloudInstanceConfigResponse.created).getTime()) / (3600 * 1000));
const upTime = Math.floor((Date.now() - new Date(cloudInstanceConfigResponse.updated).getTime()) / (3600 * 1000));
const remainingHours = KURTOSIS_CLOUD_INSTANCE_MAX_UPTIME_IN_HOURS - upTime - 1;
setCloudInstanceRemainingHours(remainingHours);
} catch (error) {
Expand Down

0 comments on commit 421d275

Please sign in to comment.