cashless2ecash

cashless2ecash: pay with cards for digital cash (experimental)
Log | Files | Refs | README

commit 2a24e3a61608cd752fef82b87c5810c9f685c67c
parent 296158ce4dc5c25de8889874511df2a3fea229bd
Author: Joel-Haeberli <haebu@rubigen.ch>
Date:   Sun,  2 Jun 2024 08:43:04 +0200

log: enhance logging

Diffstat:
Mc2ec/api-auth.go | 1-
Mc2ec/proc-retrier.go | 11++++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/c2ec/api-auth.go b/c2ec/api-auth.go @@ -92,7 +92,6 @@ func AuthenticateTerminal(req *http.Request) bool { func AuthenticateWirewatcher(req *http.Request) bool { auth := req.Header.Get(AUTHORIZATION_HEADER) - LogInfo("auth", "basic auth header: "+auth) if basicAuth, found := strings.CutPrefix(auth, BASIC_AUTH_PREFIX); found { decoded, err := base64.StdEncoding.DecodeString(basicAuth) diff --git a/c2ec/proc-retrier.go b/c2ec/proc-retrier.go @@ -3,6 +3,7 @@ package main import ( "context" "errors" + "fmt" "strconv" "time" ) @@ -23,17 +24,17 @@ func RunRetrier(ctx context.Context, errs chan error) { go func() { lastlog := time.Now().Add(time.Minute * -3) for { - time.Sleep(time.Duration(1000 * time.Millisecond)) - if lastlog.Before(time.Now().Add(time.Second * -30)) { - LogInfo("proc-retrier", "attesting selected withdrawals...") - lastlog = time.Now() - } withdrawals, err := DB.GetWithdrawalsForConfirmation() + time.Sleep(time.Duration(1000 * time.Millisecond)) if err != nil { LogError("proc-retrier", err) errs <- err continue } + if lastlog.Before(time.Now().Add(time.Second * -30)) { + LogInfo("proc-retrier", fmt.Sprintf("attesting selected withdrawals. found %d ready for confirmation", len(withdrawals))) + lastlog = time.Now() + } for _, w := range withdrawals { var lastRetryTs int64 = 0 if w.LastRetryTs != nil {