[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taldir] branch master updated: make validation cleanup expiration
From: |
gnunet |
Subject: |
[taler-taldir] branch master updated: make validation cleanup expiration configurable |
Date: |
Tue, 12 Jul 2022 15:05:57 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository taldir.
The following commit(s) were added to refs/heads/master by this push:
new a658298 make validation cleanup expiration configurable
a658298 is described below
commit a658298cba37039a40f6d109a1351c2009bfe27e
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Jul 12 15:05:54 2022 +0200
make validation cleanup expiration configurable
---
cmd/taldir-server/testdata/taldir-test.conf | 1 +
config/taldir-example.conf | 1 +
pkg/rest/taldir.go | 9 ++++++++-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/cmd/taldir-server/testdata/taldir-test.conf
b/cmd/taldir-server/testdata/taldir-test.conf
index 4a87cba..75a399c 100644
--- a/cmd/taldir-server/testdata/taldir-test.conf
+++ b/cmd/taldir-server/testdata/taldir-test.conf
@@ -17,6 +17,7 @@ validation_timeframe = 10m
solution_attempt_timeframe = 1h
merchant_baseurl_private = http://merchant.taldir/instances/myInstance
merchant_token = superSecretToken
+validation_expiration = 24h
[taldir-test]
challenge_fee = KUDOS:0
diff --git a/config/taldir-example.conf b/config/taldir-example.conf
index ed7c0db..571ae05 100644
--- a/config/taldir-example.conf
+++ b/config/taldir-example.conf
@@ -17,6 +17,7 @@ solution_attempt_timeframe = 1h
merchant_baseurl_private = http://merchant.taldir/instances/myInstance
merchant_token = superSecretToken
validation_landing = testdata/templates/validation_landing.html
+validation_expiration = 24h
[taldir-email]
sender = "taldir@taler.net"
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
index 74187fa..41a6528 100644
--- a/pkg/rest/taldir.go
+++ b/pkg/rest/taldir.go
@@ -827,7 +827,14 @@ func (t *Taldir) Initialize(cfgfile string) {
// Clean up validations
- tx := t.Db.Where("created_at < ?", time.Now().AddDate(0, 0,
-1)).Delete(&Validation{})
+ validationExpStr :=
t.Cfg.Section("taldir").Key("validation_expiration").MustString("24h")
+ validationExp, err := time.ParseDuration(validationExpStr)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ tx := t.Db.Where("created_at < ?",
time.Now().Add(-validationExp)).Delete(&Validation{})
+ //tx := t.Db.Where("created_at < ?", time.Now().AddDate(0, 0,
-1)).Delete(&Validation{})
log.Printf("Cleaned up %d stale validations.\n", tx.RowsAffected)
validationLandingTplFile :=
t.Cfg.Section("taldir").Key("validation_landing").MustString("templates/validation_landing.html")
t.ValidationTpl, err = template.ParseFiles(validationLandingTplFile)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taldir] branch master updated: make validation cleanup expiration configurable,
gnunet <=