Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Polling Support #1109

Merged
merged 26 commits into from
Feb 24, 2021
Merged

Polling Support #1109

merged 26 commits into from
Feb 24, 2021

Conversation

mitchellh
Copy link
Contributor

This introduces support for polling and triggering an up on any changes in Git.

The primary architecture of this is as follows: the Project structure maintains the polling settings. New APIs were added to the state package to grab the next project to poll that returns a deadline (when to poll). A new single goroutine poller is now started by the server which grabs that next project to poll, waits until the deadline, then queues a poll job. There is some watchset handling in there to detect the case that the project settings changes or projects were added/removed.

Note, especially for @evanphx: I'm still unhappy with the datasource interface in general and still want to take a broad pass at that. For this PR, I just kind of forced in the interface functions required to make this work. This is all internal logic though and we only have one real implementation (Git) so I think we can fix this up later without affecting any users.

I expect this to have bugs and imperfections! I did my best to test various cases. This PR is primarily about laying the major minimum implementation for this feature.

Copy link
Contributor

@evanphx evanphx left a comment

Choose a reason for hiding this comment

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

Looks good, mostly questions around some comment clarity.

internal/datasource/git.go Show resolved Hide resolved
internal/datasource/git_test.go Show resolved Hide resolved
internal/runner/data.go Outdated Show resolved Hide resolved
internal/runner/data.go Outdated Show resolved Hide resolved
internal/server/proto/server.proto Outdated Show resolved Hide resolved
internal/server/singleprocess/poll.go Show resolved Hide resolved
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Exciting to see this come together! I haven't stepped through everything, but I left a couple of change requests and questions for now 😄

internal/cli/project_apply.go Outdated Show resolved Hide resolved
internal/datasource/git.go Outdated Show resolved Hide resolved
}

// wait for deletion to complete
err = wait.PollImmediate(2*time.Second, 10*time.Minute, func() (bool, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I've noticed we end up waiting 10 minutes for a lot of things in the k8s platform. Is this a reasonable amount of time? Is 5 minutes not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On Azure stuff like PVCs sometimes take that long. :|

@mitchellh mitchellh merged commit 9dc049d into main Feb 24, 2021
@mitchellh mitchellh deleted the f-poll branch February 24, 2021 17:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants