Skip to content

add estimated time for shadeform#46

Merged
theFong merged 3 commits intomainfrom
add-esimated-time-shadeform
Sep 25, 2025
Merged

add estimated time for shadeform#46
theFong merged 3 commits intomainfrom
add-esimated-time-shadeform

Conversation

@theFong
Copy link
Member

@theFong theFong commented Sep 23, 2025

No description provided.

@theFong theFong requested a review from drewmalin September 24, 2025 23:15
}
}
return estimatedDeployTime
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor but could reduce indentation here:

func (c *ShadeformClient) getEstimatedDeployTime(shadeformInstanceType openapi.InstanceType) *time.Duration {
	bootTime := shadeformInstanceType.BootTime
	if bootTime == nil {
		return nil
	}

	minSec := bootTime.MinBootInSec
	maxSec := bootTime.MaxBootInSec

	var estimatedDeployTime *time.Duration
	if minSec != nil && maxSec != nil { //nolint:gocritic // if else fine
		avg := (*minSec + *maxSec) / 2
		avgDuration := time.Duration(avg) * time.Second
		estimatedDeployTime = &avgDuration
	} else if minSec != nil {
		d := time.Duration(*minSec) * time.Second
		estimatedDeployTime = &d
	} else if maxSec != nil {
		d := time.Duration(*maxSec) * time.Second
		estimatedDeployTime = &d
	}
	return estimatedDeployTime
}

Copy link
Member Author

Choose a reason for hiding this comment

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

love

@theFong theFong merged commit 2e017f4 into main Sep 25, 2025
2 of 3 checks passed
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.

2 participants