Skip to content

Commit 9518cac

Browse files
committed
fix units
1 parent 8e2543d commit 9518cac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stream.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func newStreamKey() *streamKey {
5858

5959
// generateID doesn't lock the mutex
6060
func (s *streamKey) generateID(now time.Time) string {
61-
ts := uint64(now.UnixNano()) / 1_000_000
61+
ts := uint64(now.UnixMilli())
6262

6363
next := fmt.Sprintf("%d-%d", ts, 0)
6464
if s.lastAllocatedID != "" && streamCmp(s.lastAllocatedID, next) >= 0 {
@@ -244,7 +244,7 @@ func (s *streamKey) add(entryID string, values []string, now time.Time) (string,
244244
parts := strings.Split(entryID, "-")
245245
if len(parts) == 2 && parts[1] == "*" {
246246
if ts, err := strconv.Atoi(parts[0]); err == nil {
247-
entryID = s.generateID(time.Unix(int64(ts), 0))
247+
entryID = s.generateID(time.UnixMilli(int64(ts)))
248248
}
249249
}
250250
}

0 commit comments

Comments
 (0)