Skip to content

Commit

Permalink
Use crypto/rand Reader instead of math/rand
Browse files Browse the repository at this point in the history
  • Loading branch information
benclive committed Jul 3, 2024
1 parent 2ea4e18 commit 64e8fd6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/storage/chunk/client/object_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package client
import (
"bytes"
"context"
"crypto/rand"
"encoding/base64"
"io"
"math/rand"
"strings"
"time"

Expand Down Expand Up @@ -101,7 +101,6 @@ func NewClientWithMaxParallel(store ObjectClient, encoder KeyEncoder, maxParalle
keyEncoder: encoder,
getChunkMaxParallel: maxParallel,
schema: schema,
entropy: rand.New(rand.NewSource(time.Now().UnixNano())),
}
}

Expand All @@ -116,7 +115,7 @@ func (o *client) PutWal(ctx context.Context, segment *wal.SegmentWriter) error {
if err != nil {
return err
}
newUlid := ulid.MustNew(ulid.Timestamp(time.Now()), o.entropy)
newUlid := ulid.MustNew(ulid.Timestamp(time.Now()), rand.Reader)
return o.store.PutObject(ctx, "loki-v2/wal/anon/"+newUlid.String(), bytes.NewReader(buffer.Bytes()))
}

Expand Down

0 comments on commit 64e8fd6

Please sign in to comment.