Skip to content

Commit

Permalink
Make sure stats time is never zero (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwang92 committed Sep 2, 2021
1 parent 0188032 commit 9eb45f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"time"

"github.com/jacktrip/jacktrip-agent/pkg/client"
)
Expand All @@ -35,6 +36,10 @@ const (
func sendPing(ping client.AgentPing, apiOrigin string) (client.AgentConfig, error) {
var config client.AgentConfig

if ping.StatsUpdatedAt.IsZero() {
ping.StatsUpdatedAt = time.Now()
}

// update and encode ping content
pingBytes, err := json.Marshal(ping)
if err != nil {
Expand Down

0 comments on commit 9eb45f2

Please sign in to comment.