Skip to content

Commit ffb97b0

Browse files
authored
feat: Time values are truncated uniformly (#825)
1 parent 4cd3872 commit ffb97b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clients/destination/v0/destination.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ func (c *Client) Write(ctx context.Context, source string, syncTime time.Time, r
260260
if err != nil {
261261
return 0, fmt.Errorf("failed to call Write: %w", err)
262262
}
263+
syncTime = syncTime.Truncate(time.Microsecond)
263264
for resource := range resources {
264265
if err := saveClient.Send(&pb.Write_Request{
265266
Resource: resource,
@@ -297,7 +298,7 @@ func (c *Client) Write2(ctx context.Context, sourceSpec specs.Source, tables sch
297298
if err := saveClient.Send(&pb.Write2_Request{
298299
Tables: b,
299300
Source: sourceSpec.Name,
300-
Timestamp: timestamppb.New(syncTime),
301+
Timestamp: timestamppb.New(syncTime.Truncate(time.Microsecond)),
301302
SourceSpec: sourceSpecBytes,
302303
}); err != nil {
303304
return fmt.Errorf("failed to send tables: %w", err)
@@ -335,7 +336,7 @@ func (c *Client) DeleteStale(ctx context.Context, tables schema.Tables, source s
335336
}
336337
if _, err := c.pbClient.DeleteStale(ctx, &pb.DeleteStale_Request{
337338
Source: source,
338-
Timestamp: timestamppb.New(timestamp),
339+
Timestamp: timestamppb.New(timestamp.Truncate(time.Microsecond)),
339340
Tables: b,
340341
}); err != nil {
341342
return fmt.Errorf("failed to call DeleteStale: %w", err)

0 commit comments

Comments
 (0)