From 85f3169689251832d5333a053ef18364b8dccaa2 Mon Sep 17 00:00:00 2001 From: ditatompel Date: Mon, 3 Jun 2024 19:26:12 +0700 Subject: [PATCH] Only call time.Now() once --- internal/monero/report.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/monero/report.go b/internal/monero/report.go index 1e56264..56f7625 100644 --- a/internal/monero/report.go +++ b/internal/monero/report.go @@ -170,6 +170,8 @@ func (r *MoneroRepo) ProcessJob(report ProbeReport, proberId int64) error { return errors.New("Invalid node") } + now := time.Now() + qInsertLog := ` INSERT INTO tbl_probe_log ( node_id, @@ -205,14 +207,13 @@ func (r *MoneroRepo) ProcessJob(report ProbeReport, proberId int64) error { report.NodeInfo.DatabaseSize, report.NodeInfo.Difficulty, report.NodeInfo.EstimateFee, - time.Now().Unix(), + now.Unix(), report.Message, report.TookTime) if err != nil { return err } - now := time.Now() limitTs := now.AddDate(0, -1, 0).Unix() nodeStats := struct {