Skip to content

Commit

Permalink
refresh cache if there was error
Browse files Browse the repository at this point in the history
  • Loading branch information
medyagh committed Aug 10, 2020
1 parent b1cab41 commit 2580006
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cmd/minikube/cmd/start_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
cc = updateExistingConfigFromFlags(cmd, existing)
} else {
glog.Info("no existing cluster config was found, will generate one from the flags ")
sysLimit, containerLimit, err := memoryLimits(drvName)
if err != nil {
glog.Warningf("Unable to query memory limits: %v", err)
sysLimit, containerLimit, errs := memoryLimits(drvName)
if errs != nil {
glog.Warningf("Unable to query memory limits: %+v", errs)
}

mem := suggestMemoryAllocation(sysLimit, containerLimit, viper.GetInt(nodes))
if cmd.Flags().Changed(memory) {
mem, err = pkgutil.CalculateSizeInMB(viper.GetString(memory))
mem, err := pkgutil.CalculateSizeInMB(viper.GetString(memory))
if err != nil {
exit.WithCodeT(exit.Config, "Generate unable to parse memory '{{.memory}}': {{.error}}", out.V{"memory": viper.GetString(memory), "error": err})
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/minikube/machine/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var cachedSystemMemoryErr *error

// cachedSysMemLimit will return a cached limit for the system's virtual memory.
func cachedSysMemLimit() (*mem.VirtualMemoryStat, error) {
if cachedSystemMemoryLimit == nil {
if cachedSystemMemoryLimit == nil || cachedSystemMemoryErr != nil {
v, err := mem.VirtualMemory()
cachedSystemMemoryLimit = v
cachedSystemMemoryErr = &err
Expand All @@ -123,7 +123,7 @@ var cachedDiskInfoeErr *error

// cachedDiskInfo will return a cached disk usage info
func cachedDiskInfo() (disk.UsageStat, error) {
if cachedDisk == nil {
if cachedDisk == nil || cachedDiskInfoeErr != nil {
d, err := disk.Usage("/")
cachedDisk = d
cachedDiskInfoeErr = &err
Expand All @@ -136,7 +136,7 @@ var cachedCPUErr *error

// cachedCPUInfo will return a cached cpu info
func cachedCPUInfo() ([]cpu.InfoStat, error) {
if cachedCPU == nil {
if cachedCPU == nil || cachedCPUErr != nil {
i, err := cpu.Info()
cachedCPU = &i
cachedCPUErr = &err
Expand Down

0 comments on commit 2580006

Please sign in to comment.