Only call time.Now() once

This commit is contained in:
ditatompel 2024-06-03 19:26:12 +07:00
parent a0ff254f55
commit 85f3169689
No known key found for this signature in database
GPG key ID: 31D3D06D77950979

View file

@ -170,6 +170,8 @@ func (r *MoneroRepo) ProcessJob(report ProbeReport, proberId int64) error {
return errors.New("Invalid node") return errors.New("Invalid node")
} }
now := time.Now()
qInsertLog := ` qInsertLog := `
INSERT INTO tbl_probe_log ( INSERT INTO tbl_probe_log (
node_id, node_id,
@ -205,14 +207,13 @@ func (r *MoneroRepo) ProcessJob(report ProbeReport, proberId int64) error {
report.NodeInfo.DatabaseSize, report.NodeInfo.DatabaseSize,
report.NodeInfo.Difficulty, report.NodeInfo.Difficulty,
report.NodeInfo.EstimateFee, report.NodeInfo.EstimateFee,
time.Now().Unix(), now.Unix(),
report.Message, report.Message,
report.TookTime) report.TookTime)
if err != nil { if err != nil {
return err return err
} }
now := time.Now()
limitTs := now.AddDate(0, -1, 0).Unix() limitTs := now.AddDate(0, -1, 0).Unix()
nodeStats := struct { nodeStats := struct {