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

Support Configuration Hot Reloading #346

Merged
merged 10 commits into from
Nov 29, 2024
Merged

Support Configuration Hot Reloading #346

merged 10 commits into from
Nov 29, 2024

Conversation

Michad
Copy link
Owner

@Michad Michad commented Nov 28, 2024

Implements #198

Adds a new CLI flag when running serve command to enable hot reloading of configuration whenever the file changes. Relies on viper's wrapper for fsnotify hooks so doesn't yet support etcd/other remote providers. Includes documentation of what can be reloaded. Limited to the main tile serve endpoint.

Copy link
Contributor

Libyears is 3.45

Copy link
Contributor

Code coverage is 89.1%

Copy link
Contributor

Libyears is 2.42

Copy link
Contributor

Libyears is 2.42

Copy link
Contributor

Code coverage is 89.1%

1 similar comment
Copy link
Contributor

Code coverage is 89.1%

@@ -70,9 +73,21 @@ func newTileHandler(handler defaultHandler) (tileHandler, error) {
}, errors.Join(err1, err2, err3, err4)
}

func (h *tileHandler) reloadEntities(newEntities reloadableEntities) {
slog.WarnContext(pkg.BackgroundContext(), "Requesting to refresh entities from configuration")
h.mux.Lock()
Copy link
Owner Author

Choose a reason for hiding this comment

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

Do I really need this mutex? I put it in thinking I'd need to do multiple setters but given it ended up being just one, that should be atomic right?

Copy link
Contributor

Libyears is 2.42

Copy link
Contributor

Code coverage is 89.1%

Copy link
Contributor

Libyears is 2.42

Copy link
Contributor

Libyears is 2.42

Copy link
Contributor

Code coverage is 89.1%

1 similar comment
Copy link
Contributor

Code coverage is 89.1%

@Michad Michad merged commit ba73dcb into main Nov 29, 2024
14 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.

1 participant