Skip to content

Commit

Permalink
cached for ErrNoRows
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-priyanka-bagade committed Nov 19, 2024
1 parent c1e8a61 commit 45da947
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/pubmatic/openwrap/cache/gocache/partner_config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gocache

import (
"database/sql"
"errors"
"fmt"
"strconv"
Expand Down Expand Up @@ -68,6 +69,10 @@ func (c *cache) getActivePartnerConfigAndPopulateWrapperMappings(pubID, profileI
cacheKey := key(PUB_HB_PARTNER, pubID, profileID, displayVersion)
partnerConfigMap, err := c.db.GetActivePartnerConfigurations(pubID, profileID, displayVersion)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
c.cache.Set(cacheKey, partnerConfigMap, getSeconds(c.cfg.CacheDefaultExpiry))
glog.Errorf("No rows found for partner config query for pubID %d, profileID %d: %v", pubID, profileID, err)
}
c.metricEngine.RecordDBQueryFailure(models.PartnerConfigQuery, strconv.Itoa(pubID), strconv.Itoa(profileID))
glog.Errorf(models.ErrDBQueryFailed, models.PartnerConfigQuery, pubID, profileID, err)
return err
Expand Down

0 comments on commit 45da947

Please sign in to comment.