mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: cap data import according to max data retention time
This commit is contained in:
@@ -45,11 +45,7 @@ func (s *HousekeepingService) Schedule() {
|
||||
|
||||
// schedule jobs
|
||||
for _, u := range users {
|
||||
// don't clean data for subscribed users
|
||||
if s.config.Subscriptions.Enabled && u.HasActiveSubscription() {
|
||||
continue
|
||||
}
|
||||
|
||||
// don't clean data for subscribed users or when they otherwise have unlimited data access
|
||||
if u.MinDataAge().IsZero() {
|
||||
continue
|
||||
}
|
||||
|
@@ -116,7 +116,11 @@ func (w *WakatimeHeartbeatImporter) Import(user *models.User, minFrom time.Time,
|
||||
}
|
||||
}
|
||||
|
||||
logbuch.Info("scheduling wakatime import for user '%s'", user.ID)
|
||||
if minDataAge := user.MinDataAge(); minFrom.Before(minDataAge) {
|
||||
logbuch.Info("wakatime data import for user '%s' capped to [%v, &v]", user.ID, minDataAge, maxTo)
|
||||
}
|
||||
|
||||
logbuch.Info("scheduling wakatime import for user '%s' (interval [%v, &v])", user.ID, minFrom, maxTo)
|
||||
if err := w.queue.Dispatch(func() {
|
||||
process(user, minFrom, maxTo, out)
|
||||
}); err != nil {
|
||||
|
Reference in New Issue
Block a user