-
Notifications
You must be signed in to change notification settings - Fork 32
Dynamic Config #664
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
base: main
Are you sure you want to change the base?
Dynamic Config #664
Conversation
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.
Reads really well, I like how this refreshes fixed values a lot more than having that bloat directly in each instance of Dynamic.
I'd really like to have some Unit tests for the cursed reflect logic, AI should be pretty great at writing that sort of thing.
Also linters are complaining.
deps/config/dynamic.go
Outdated
} | ||
|
||
func (r *cfgRoot) changeMonitor() { | ||
lastTimestamp := time.Now().Add(-30 * time.Second) // plenty of time for start-up |
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'd prefer some global flag for this. Large storage servers with millions of files on hard drives may need a few minutes for proper startup
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.
A simpler alternative is to look for changes at start-up. A single table read I/O is a small price to pay.
deps/config/dynamic.go
Outdated
func() { | ||
DynamicMx.Lock() | ||
defer DynamicMx.Unlock() | ||
ApplyLayers(context.Background(), r.treeCopy, configs) |
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.
Linter somewhat rightfully complains about a missing err check
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.
done
deps/config/dynamic.go
Outdated
defer DynamicMx.Unlock() | ||
ApplyLayers(context.Background(), r.treeCopy, configs) | ||
}() | ||
DynamicMx.Lock() |
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.
Stray lock?
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.
yep
Benefit:
Compatible configs populate the latest value (with respect to the layers) every 30 seconds on running servers without restarting.
Work Remaining:
Decision-Points:
Punchlist (for future PRs):
-- XXMax P4, medium difficulty
-- StorageMarketConfig
--- MK12 - all here, P3, easy-ish
--- IPNI - no need?