Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: fix null pointer on external provisioner daemons with daily_cost#9401

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

spikecurtis
Copy link
Contributor

fixes#8785

@spikecurtis
Copy link
ContributorAuthor

I did a little refactor on the provisionerdserver so that it's explicit about what arguments are required and what are optional, so that we're less likely to pass null pointers by omission.

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Tests seem to be failing, but I'm otherwise fine with the change (sans panics). The other suggestion re: args, feel free to consider or disregard.

}
if deploymentValues == nil {
panic("deploymentValues is nil")
}
Copy link
Member

Choose a reason for hiding this comment

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

I would rather we return errors here so this can be handled more gracefully at the calling site.

Let's say we introduce a regression where, in a certain configuration, some of these are passed as nil. So our tests don't catch it, but our customer will. By the time these panic,coderd could've started some work that will be canceled abruptly (hypothetically, probably not the way todays server starts up, but in the future).

api.TemplateScheduleStore,
api.UserQuietHoursScheduleStore,
api.DeploymentValues,
debounce,
Copy link
Member

Choose a reason for hiding this comment

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

This feels like a lot of args and has it's own risk of mixed up arg order when there are same types (not the case here, now). Typically I'd revert to a struct but I understand why we're making this change. Two structs may be another option. We have a linter that checks that all fields are set (only enabled for certain types atm).

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The "a lot of args" is it's own code smell, and is a symptom of poor code architecture to have so many required args.

Making it a struct makes it too easy to leave off required arguments. It doesn't reduce the amount of code, and in fact, increases it.

Copy link
Member

@mafredrimafredriAug 29, 2023
edited
Loading

Choose a reason for hiding this comment

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

Making it a struct makes it too easy to leave off required arguments. It doesn't reduce the amount of code, and in fact, increases it.

I think we should value clarity more-so than reducing the number of characters. And it's not like it would increase LOC, just verbosity (but also clarity). But again, feel free to take this as a suggestion, not as an asked change.

PS. I was making a case for a linter that detects missing fields. And the struct fields can be further verified inNew (like some args are now). IMO that levels the playing field.

Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis
Copy link
ContributorAuthor

spikecurtis commentedAug 30, 2023
edited
Loading

I've disabled "debounce" in external provisioners. This matches the status quo, but is still a problem, because lots of external provisioners can create a large query burden on the DB. Tracking that here:#9428

Setting debounce was causing test flakes because debounce relies on global state and thus tests were getting debounced by one another.

@spikecurtisspikecurtisenabled auto-merge (squash)August 30, 2023 10:48
@spikecurtisspikecurtis merged commit90acf99 intomainAug 30, 2023
@spikecurtisspikecurtis deleted the spike/8785-daily-cost-ext-provisioner-daemon branchAugust 30, 2023 10:48
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 30, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@kylecarbskylecarbsAwaiting requested review from kylecarbs

Assignees

@spikecurtisspikecurtis

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Using external provisionerd with daily_cost won't work
2 participants
@spikecurtis@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp