Skip to content

Commit

Permalink
Revert "all: using the more elegant way to deal milliseconds and nano…
Browse files Browse the repository at this point in the history
…seconds (#292)" (#306)

This reverts commit 9d6c353.
  • Loading branch information
ludoch committed Mar 16, 2023
1 parent 9d6c353 commit 917b599
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/api.go
Expand Up @@ -550,7 +550,7 @@ func logf(c *aeContext, level int64, format string, args ...interface{}) {
s = strings.TrimRight(s, "\n") // Remove any trailing newline characters.
if logToLogservice() {
c.addLogLine(&logpb.UserAppLogLine{
TimestampUsec: proto.Int64(time.Now().UnixMicro()),
TimestampUsec: proto.Int64(time.Now().UnixNano() / 1e3),
Level: &level,
Message: &s,
})
Expand Down
4 changes: 2 additions & 2 deletions log/log.go
Expand Up @@ -245,10 +245,10 @@ func makeRequest(params *Query, appID, versionID string) (*pb.LogReadRequest, er
req := &pb.LogReadRequest{}
req.AppId = &appID
if !params.StartTime.IsZero() {
req.StartTime = proto.Int64(params.StartTime.UnixMicro())
req.StartTime = proto.Int64(params.StartTime.UnixNano() / 1e3)
}
if !params.EndTime.IsZero() {
req.EndTime = proto.Int64(params.EndTime.UnixMicro())
req.EndTime = proto.Int64(params.EndTime.UnixNano() / 1e3)
}
if len(params.Offset) > 0 {
var offset pb.LogOffset
Expand Down
2 changes: 1 addition & 1 deletion search/search.go
Expand Up @@ -977,7 +977,7 @@ func fieldsToProto(src []Field) ([]*pb.Field, error) {
}
timeFields[f.Name] = true
fieldValue.Type = pb.FieldValue_DATE.Enum()
fieldValue.StringValue = proto.String(strconv.FormatInt(x.UnixMilli(), 10))
fieldValue.StringValue = proto.String(strconv.FormatInt(x.UnixNano()/1e6, 10))
case float64:
if numericFields[f.Name] {
return nil, fmt.Errorf("search: duplicate numeric field %q", f.Name)
Expand Down
4 changes: 2 additions & 2 deletions taskqueue/taskqueue.go
Expand Up @@ -216,7 +216,7 @@ func newAddReq(c context.Context, task *Task, queueName string) (*pb.TaskQueueAd
req := &pb.TaskQueueAddRequest{
QueueName: []byte(queueName),
TaskName: []byte(task.Name),
EtaUsec: proto.Int64(eta.UnixMicro()),
EtaUsec: proto.Int64(eta.UnixNano() / 1e3),
}
method := task.method()
if method == "PULL" {
Expand Down Expand Up @@ -467,7 +467,7 @@ func ModifyLease(c context.Context, task *Task, queueName string, leaseTime int)
req := &pb.TaskQueueModifyTaskLeaseRequest{
QueueName: []byte(queueName),
TaskName: []byte(task.Name),
EtaUsec: proto.Int64(task.ETA.UnixMicro()), // Used to verify ownership.
EtaUsec: proto.Int64(task.ETA.UnixNano() / 1e3), // Used to verify ownership.
LeaseSeconds: proto.Float64(float64(leaseTime)),
}
res := &pb.TaskQueueModifyTaskLeaseResponse{}
Expand Down
4 changes: 2 additions & 2 deletions v2/taskqueue/taskqueue.go
Expand Up @@ -216,7 +216,7 @@ func newAddReq(c context.Context, task *Task, queueName string) (*pb.TaskQueueAd
req := &pb.TaskQueueAddRequest{
QueueName: []byte(queueName),
TaskName: []byte(task.Name),
EtaUsec: proto.Int64(eta.UnixMicro()),
EtaUsec: proto.Int64(eta.UnixNano() / 1e3),
}
method := task.method()
if method == "PULL" {
Expand Down Expand Up @@ -467,7 +467,7 @@ func ModifyLease(c context.Context, task *Task, queueName string, leaseTime int)
req := &pb.TaskQueueModifyTaskLeaseRequest{
QueueName: []byte(queueName),
TaskName: []byte(task.Name),
EtaUsec: proto.Int64(task.ETA.UnixMicro()), // Used to verify ownership.
EtaUsec: proto.Int64(task.ETA.UnixNano() / 1e3), // Used to verify ownership.
LeaseSeconds: proto.Float64(float64(leaseTime)),
}
res := &pb.TaskQueueModifyTaskLeaseResponse{}
Expand Down

0 comments on commit 917b599

Please sign in to comment.