fix: don't throw error while fetching orgname (#4496)

* fix: don't throw error while fetching orgname

* fix: don't ignore the error
This commit is contained in:
Nityananda Gohain 2024-02-05 20:23:20 +05:30 committed by GitHub
parent 9d689693b4
commit 554c4332c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -139,17 +139,13 @@ func (lm *Manager) UploadUsage() {
zap.S().Info("uploading usage data")
// Try to get the org name
orgName := ""
orgNames, err := lm.modelDao.GetOrgs(ctx)
if err != nil {
zap.S().Errorf("failed to get org data: %v", zap.Error(err))
} else {
if len(orgNames) != 1 {
zap.S().Errorf("expected one org but got %d orgs", len(orgNames))
} else {
orgName = orgNames[0].Name
}
orgNames, orgError := lm.modelDao.GetOrgs(ctx)
if orgError != nil {
zap.S().Errorf("failed to get org data: %v", zap.Error(orgError))
}
if len(orgNames) == 1 {
orgName = orgNames[0].Name
}
usagesPayload := []model.Usage{}