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

Reload config on update #357

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

elliotpeele
Copy link

This PR adds automatic reloading of the configuration file when the file is written. It mostly focuses on updates to the repository list. Resolves #287

@salemhilal
Copy link
Contributor

Thank you for this PR! I'll look it over this weekend. Very excited about this one.

Just as a heads up, there's a pending PR to set up go modules in this repo, which might have implications for how you add fsnotify:
#353

I'll prioritize merging that PR in so that it unblocks this PR, but you'll probably need to move fsnotify once it's merged.

@salemhilal
Copy link
Contributor

Hey @elliotpeele, thanks for being patient with us. #353 has been merged. Do you mind updating this PR to use go modules instead?

@elliotpeele
Copy link
Author

I don't mind updating to use modules. BTW, I found an issue with the PR where over time, as the config gets updated, the indexes get removed. I haven't had time to work on a resolution yet though.

@salemhilal
Copy link
Contributor

Got it. I'll hold off on reviewing this until I hear more, just so I can prioritize clearing out some of the outstanding backlog.

@elliotpeele
Copy link
Author

@salemhilal, I finally got back to this. Found why the indexes were getting deleted when the config updated and updated the PR.

@salemhilal
Copy link
Contributor

Thank you @elliotpeele! I'm a little swamped at the moment, but I haven't forgotten about this PR. I appreciate the update and will give it a closer look shortly.

@kkom
Copy link

kkom commented Feb 13, 2021

Hey! Is there any way in which I can help in getting this merged? I know only a little Go and I'm not at all familiar with Hound's codebase, but if it was rebased on top of head I can run this on our test deployment and report any issues!

@salemhilal
Copy link
Contributor

hey @kkom, I'm going to try and set aside some time to day to validate this PR. Thanks again (to everyone on this PR) for being patient.

@kkom
Copy link

kkom commented Feb 15, 2021

Thanks @salemhilal – let me know if any prolonged testing would help, happy to do it, as I'm just about to set up a POC deployment of Hound!

Copy link
Contributor

@salemhilal salemhilal left a comment

Choose a reason for hiding this comment

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

Hey @elliotpeele, I left a bunch of small comments. Let me know what you think, and if you can, rebase the handful of upstream changes into this branch. I'll give it another once-over afterwards (much faster this time, I promise) and I'll merge this in. Thanks again for your contribution.

@@ -5,7 +5,8 @@ ENV GOPATH /go
COPY . /go/src/github.com/hound-search/hound

RUN apk update \
&& apk add go git subversion libc-dev mercurial bzr openssh \
&& apk add go git subversion libc-dev mercurial openssh \
&& go get github.com/fsnotify/fsnotify \
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mind adding this as a go module instead?

api.Setup(m, idx)
return http.ListenAndServe(addr, m)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

These two methods are deleted because they are unused, correct?

@@ -223,7 +223,7 @@ func findExistingRefs(dbpath string) (*foundRefs, error) {

return &foundRefs{
refs: refs,
claimed: map[*index.IndexRef]bool{},
claimed: map[string]bool{},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give me some details about why the key type of claimed here was swapped out to be a string rather than a pointer to an IndexRef ?

@@ -129,7 +129,7 @@ func (h *prdHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ct := h.content[p]
if ct != nil {
// if so, render it
if err := renderForPrd(w, ct, h.cfg, h.cfgJson, r); err != nil {
if err := renderForPrd(w, ct, h.cfg, r); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

this diff makes me think that prdHandler.cfgJson should be updated, rather than updating these to all use the reference to the Config object. Otherwise, the two would drift from each other.

Base automatically changed from master to main February 24, 2021 17:03
@jrarmstro
Copy link
Contributor

I'm interested in picking this up if @elliotpeele does not.

@elliotpeele
Copy link
Author

@jrarmstro I haven't had time to get back around to this. Feel free to pick it up.

@bm1549
Copy link

bm1549 commented Jan 11, 2023

Are there any plans to revive this PR?

@mumblepins mumblepins mentioned this pull request Sep 6, 2023
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Current work
In progress
Development

Successfully merging this pull request may close these issues.

Do not support hot-reloading config.json ?
5 participants