Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaler cleanups #188

Merged
merged 16 commits into from
Jul 18, 2024
Merged

Scaler cleanups #188

merged 16 commits into from
Jul 18, 2024

Conversation

DrJosh9000
Copy link
Contributor

This is a grab-bag of code cleanups.

The only significant change should be that scaler.Run now happens before checking timeout, so the lambda won't time out before it does anything useful (regardless of LAMBDA_TIMEOUT).

Copy link
Contributor

@wolfeidau wolfeidau left a comment

Choose a reason for hiding this comment

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

Minor observations and nitpicks.

lambda/main.go Outdated
Comment on lines 79 to 86
agentsPerInstanceStr := os.Getenv("AGENTS_PER_INSTANCE")
if agentsPerInstanceStr == "" {
return "", errors.New("AGENTS_PER_INSTANCE is required")
}
agentsPerInstance, err := strconv.Atoi(agentsPerInstanceStr)
if err != nil {
return "", fmt.Errorf("AGENTS_PER_INSTANCE must be an integer: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer a function for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored the environment variable loading back towards a few helper functions, which I feel also resolves the comments below. Since they all error out of the lambda handler, making it useless, I've leaned towards log.Fatalf.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

lambda/main.go Outdated Show resolved Hide resolved
lambda/main.go Outdated Show resolved Hide resolved
lambda/main.go Outdated Show resolved Hide resolved
lambda/main.go Outdated Show resolved Hide resolved
@DrJosh9000 DrJosh9000 merged commit b417760 into master Jul 18, 2024
1 check passed
@DrJosh9000 DrJosh9000 deleted the scaler-cleanups branch July 18, 2024 06:56
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