Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Fixup timestamp usage
Browse files Browse the repository at this point in the history
  • Loading branch information
briancain committed Jan 3, 2022
1 parent 5a2764a commit 2f0aa02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions internal/cli/trigger_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/dustin/go-humanize"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/ptypes"
"github.com/posener/complete"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -117,9 +116,9 @@ func (c *TriggerInspectCommand) Run(args []string) int {
tags = strings.Join(trigger.Tags[:], ", ")
}

var lastActiveTime string
if time, err := ptypes.Timestamp(trigger.ActiveTime); err == nil {
lastActiveTime = humanize.Time(time)
lastActiveTime := "unknown"
if trigger.ActiveTime.IsValid() {
lastActiveTime = humanize.Time(trigger.ActiveTime.AsTime())
}

c.ui.Output("Trigger URL config:", terminal.WithHeaderStyle())
Expand Down
3 changes: 1 addition & 2 deletions internal/server/singleprocess/service_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package singleprocess

import (
"context"
"time"

"github.com/golang/protobuf/ptypes/empty"
"github.com/hashicorp/go-hclog"
Expand Down Expand Up @@ -178,7 +177,7 @@ func (s *service) RunTrigger(
log.Debug("run trigger job(s) have been queued")

// Trigger has been requested to queue jobs, update active time
runTrigger.ActiveTime = timestamppb.New(time.Now())
runTrigger.ActiveTime = timestamppb.Now()
err = s.state.TriggerPut(runTrigger)
if err != nil {
return nil, err
Expand Down

0 comments on commit 2f0aa02

Please sign in to comment.