hostinfo: cache device model to speed up init
This was causing a relatively consistent ~10ms of delay on Linux. Signed-off-by: Kyle Carberry <kyle@carberry.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
ec87e219ae
commit
27038ee3c2
@ -22,9 +22,7 @@ func init() {
|
||||
distroName = distroNameLinux
|
||||
distroVersion = distroVersionLinux
|
||||
distroCodeName = distroCodeNameLinux
|
||||
if v := linuxDeviceModel(); v != "" {
|
||||
SetDeviceModel(v)
|
||||
}
|
||||
deviceModel = deviceModelLinux
|
||||
}
|
||||
|
||||
var (
|
||||
@ -50,7 +48,7 @@ func distroCodeNameLinux() string {
|
||||
return lazyVersionMeta.Get().DistroCodeName
|
||||
}
|
||||
|
||||
func linuxDeviceModel() string {
|
||||
func deviceModelLinux() string {
|
||||
for _, path := range []string{
|
||||
// First try the Synology-specific location.
|
||||
// Example: "DS916+-j"
|
||||
|
Reference in New Issue
Block a user