-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix: skip out of date file changes #1279
Conversation
buildengine/build.go
Outdated
switch project := project.(type) { | ||
case Module: | ||
func Build(ctx context.Context, sch *schema.Schema, proj Project) error { | ||
switch project := proj.(type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can and should just do switch project := project.(type) {
buildengine/build.go
Outdated
case Module: | ||
func Build(ctx context.Context, sch *schema.Schema, proj Project) error { | ||
switch project := proj.(type) { | ||
case *Module: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the pointer change?
buildengine/engine.go
Outdated
@@ -285,12 +285,19 @@ func (e *Engine) watchForModuleChanges(ctx context.Context, period time.Duration | |||
delete(e.projects, config.Key) | |||
case WatchEventProjectChanged: | |||
config := event.Project.Config() | |||
|
|||
lastBuildTime := e.projects[config.Key].GetLastBuildStartTime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think rather than making all these changes because of making Project mutable, just change the e.projects
map to use an intermediate struct that contains the Project
+ time.Time
:
type projectMeta struct {
project Project
lastBuildStartTime time.Time
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Thanks dude!
09245b5
to
eaac130
Compare
type projectMeta struct { | ||
project Project | ||
lastBuildStartTime time.Time | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alecthomas I moved away from embedding because it seems to cause more confusion than help. For example some of the methods that took in a project Project
would be ok with a projectMeta
but then the type assertions would require a projectMeta
case and I was getting lots of bugs where I should be using project.project
but I was just using project
directly. lemme know if this seems reasonable :)
Fixes #1210
This required a bit of a refactor to use pointers for
Module
andExternalLibrary
here. Hopefully, that's ok.Example of rapid changes getting skipped. Note that I logged skips in
Warnf
just to highlight for this screenshot. Real skip messages are logged atDebugf