File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -50,14 +50,25 @@ func (h *HomeAzMonitor) updateCacheValue(resp cns.GetHomeAzResponse) {
5050
5151// readCacheValue reads home az cache value
5252func (h * HomeAzMonitor ) readCacheValue () cns.GetHomeAzResponse {
53- cachedResp , found := h .values .Get (homeAzCacheKey )
54- if ! found {
55- return cns.GetHomeAzResponse {Response : cns.Response {
53+ if cachedResp , found := h .values .Get (homeAzCacheKey ); found {
54+ return cachedResp .(cns.GetHomeAzResponse )
55+ }
56+
57+ ctx , cancel := context .WithTimeout (context .Background (), ContextTimeOut )
58+ defer cancel ()
59+ h .Populate (ctx )
60+
61+ if cachedResp , found := h .values .Get (homeAzCacheKey ); found {
62+ return cachedResp .(cns.GetHomeAzResponse )
63+ }
64+
65+ return cns.GetHomeAzResponse {
66+ Response : cns.Response {
5667 ReturnCode : types .NotFound ,
5768 Message : "HomeAz Cache is unavailable" ,
58- }, HomeAzResponse : cns.HomeAzResponse {IsSupported : false }}
69+ },
70+ HomeAzResponse : cns.HomeAzResponse {IsSupported : false },
5971 }
60- return cachedResp .(cns.GetHomeAzResponse )
6172}
6273
6374// Start starts a new thread to refresh home az cache
You can’t perform that action at this time.
0 commit comments