Skip to content

Commit

Permalink
Export NotReadyReasonCode map (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Gibson <cgibson@datto.com>
  • Loading branch information
equalsgibson and Chris Gibson authored Oct 29, 2023
1 parent d35098e commit a9bbba0
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions five9/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,30 +159,30 @@ func (s *SupervisorService) GetAllQueues(ctx context.Context) ([]five9types.Queu
return target, nil
}

// func (s *SupervisorService) getReasonCodeInfoMap(ctx context.Context) (map[five9types.ReasonCodeID]five9types.ReasonCodeInfo, error) {
// timeLastUpdated := s.domainMetadataCache.reasonCodeInfoState.GetCacheAge()
func (s *SupervisorService) GetReasonCodeInfoMap(ctx context.Context) (map[five9types.ReasonCodeID]five9types.ReasonCodeInfo, error) {
timeLastUpdated := s.domainMetadataCache.reasonCodeInfoState.GetCacheAge()

// if timeLastUpdated != nil {
// if *timeLastUpdated < time.Hour {
// return s.domainMetadataCache.reasonCodeInfoState.GetAll().Items, nil
// }
// }
if timeLastUpdated != nil {
if *timeLastUpdated < time.Hour {
return s.domainMetadataCache.reasonCodeInfoState.GetAll().Items, nil
}
}

// reasonCodes, err := s.GetAllReasonCodes(ctx)
// if err != nil {
// return nil, err
// }
reasonCodes, err := s.GetAllReasonCodes(ctx)
if err != nil {
return nil, err
}

// freshData := map[five9types.ReasonCodeID]five9types.ReasonCodeInfo{}
freshData := map[five9types.ReasonCodeID]five9types.ReasonCodeInfo{}

// for _, reasonCode := range reasonCodes {
// freshData[reasonCode.ID] = reasonCode
// }
for _, reasonCode := range reasonCodes {
freshData[reasonCode.ID] = reasonCode
}

// s.domainMetadataCache.reasonCodeInfoState.Replace(freshData)
s.domainMetadataCache.reasonCodeInfoState.Replace(freshData)

// return freshData, nil
// }
return freshData, nil
}

func (s *SupervisorService) GetAllReasonCodes(ctx context.Context) ([]five9types.ReasonCodeInfo, error) {
reasonCodes := []five9types.ReasonCodeInfo{}
Expand Down

0 comments on commit a9bbba0

Please sign in to comment.