Skip to content

Commit

Permalink
fix: skip summary cache for sub second-level date precision (resolve #…
Browse files Browse the repository at this point in the history
  • Loading branch information
muety committed Sep 20, 2023
1 parent 7db470c commit 37ac895
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions services/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ func NewSummaryService(summaryRepo repositories.ISummaryRepository, durationServ

// Aliased retrieves or computes a new summary based on the given SummaryRetriever and augments it with entity aliases and project labels
func (srv *SummaryService) Aliased(from, to time.Time, user *models.User, f types.SummaryRetriever, filters *models.Filters, skipCache bool) (*models.Summary, error) {
// Check cache
// Check cache (or skip for sub second-level date precision)
cacheKey := srv.getHash(from.String(), to.String(), user.ID, filters.Hash(), "--aliased")
if cacheResult, ok := srv.cache.Get(cacheKey); ok && !skipCache {
return cacheResult.(*models.Summary), nil
if to.Truncate(time.Second).Equal(to) && from.Truncate(time.Second).Equal(from) {
if cacheResult, ok := srv.cache.Get(cacheKey); ok && !skipCache {
return cacheResult.(*models.Summary), nil
}
}

// Resolver functions
Expand Down

0 comments on commit 37ac895

Please sign in to comment.