From 101fdfb957b7b965c17a0d29dc7682736bcc5922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferdinand=20M=C3=BCtsch?= Date: Thu, 10 Jun 2021 23:22:04 +0200 Subject: [PATCH] chore: adapt default insert batch size (fix #206) fix: set user data flag after import (fix #207) --- README.md | 2 +- config.default.yml | 1 + config/config.go | 2 +- routes/settings.go | 7 +++++++ version.txt | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1018bdb..60a75bf 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ | Features | - How to use + How to use | Issues | diff --git a/config.default.yml b/config.default.yml index b588e08..5a31ffb 100644 --- a/config.default.yml +++ b/config.default.yml @@ -13,6 +13,7 @@ app: aggregation_time: '02:15' # time at which to run daily aggregation batch jobs report_time_weekly: 'fri,18:00' # time at which to fan out weekly reports (format: ',') inactive_days: 7 # time of previous days within a user must have logged in to be considered active + import_batch_size: 50 # maximum number of heartbeats to insert into the database within one transaction custom_languages: vue: Vue jsx: JSX diff --git a/config/config.go b/config/config.go index 9b3cbed..214847c 100644 --- a/config/config.go +++ b/config/config.go @@ -64,7 +64,7 @@ type appConfig struct { AggregationTime string `yaml:"aggregation_time" default:"02:15" env:"WAKAPI_AGGREGATION_TIME"` ReportTimeWeekly string `yaml:"report_time_weekly" default:"fri,18:00" env:"WAKAPI_REPORT_TIME_WEEKLY"` ImportBackoffMin int `yaml:"import_backoff_min" default:"5" env:"WAKAPI_IMPORT_BACKOFF_MIN"` - ImportBatchSize int `yaml:"import_batch_size" default:"100" env:"WAKAPI_IMPORT_BATCH_SIZE"` + ImportBatchSize int `yaml:"import_batch_size" default:"50" env:"WAKAPI_IMPORT_BATCH_SIZE"` InactiveDays int `yaml:"inactive_days" default:"7" env:"WAKAPI_INACTIVE_DAYS"` CustomLanguages map[string]string `yaml:"custom_languages"` Colors map[string]map[string]string `yaml:"-"` diff --git a/routes/settings.go b/routes/settings.go index f98d938..490f939 100644 --- a/routes/settings.go +++ b/routes/settings.go @@ -450,6 +450,13 @@ func (h *SettingsHandler) actionImportWaktime(w http.ResponseWriter, r *http.Req h.regenerateSummaries(user) + if !user.HasData { + user.HasData = true + if _, err := h.userSrvc.Update(user); err != nil { + conf.Log().Request(r).Error("failed to set 'has_data' flag for user %s – %v", user.ID, err) + } + } + if user.Email != "" { if err := h.mailSrvc.SendImportNotification(user, time.Now().Sub(start), int(countAfter-countBefore)); err != nil { conf.Log().Request(r).Error("failed to send import notification mail to %s – %v", user.ID, err) diff --git a/version.txt b/version.txt index 457f038..3bae520 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.27.2 +1.27.3