Skip to content

Commit

Permalink
[DDO-3765] Absorb Google Workspace Directory API Quota Issues (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-r-warren authored Jun 28, 2024
1 parent 0bfc615 commit b10f73d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sherlock/internal/suitability_loader/sync_to_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/rs/zerolog/log"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"strings"
"time"
)

Expand All @@ -17,7 +18,7 @@ func KeepSuitabilitiesInDBUpdated(ctx context.Context, db *gorm.DB) {
for {
time.Sleep(interval)
if err := SyncSuitabilitiesToDB(ctx, db); err != nil {
log.Warn().Err(err).Msgf("failed to update suitability table")
log.Warn().Err(err).Msgf("failed to update suitability table: %v", err)
}
}
}
Expand All @@ -29,6 +30,10 @@ func SyncSuitabilitiesToDB(ctx context.Context, db *gorm.DB) error {
}
suitabilitiesFromFirecloud, err := fromFirecloud(ctx)
if err != nil {
if strings.Contains(err.Error(), "dailyLimitExceeded") {
log.Warn().Err(err).Msgf("failed to load Firecloud data due to quota limit; absorbing error (see DDO-3765) and relying on existing suitability records")
return nil
}
return err
}
suitabilities := append(suitabilitiesFromConfig, suitabilitiesFromFirecloud...)
Expand Down

0 comments on commit b10f73d

Please sign in to comment.