dont overwrite metadata
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
6dbd6e27e4
commit
4cb50e8692
10
requestid.go
10
requestid.go
@ -19,12 +19,12 @@ var (
|
|||||||
// MetadataFunc wil be used if user not provide own func to fill metadata
|
// MetadataFunc wil be used if user not provide own func to fill metadata
|
||||||
MetadataFunc = func(ctx context.Context) (context.Context, error) {
|
MetadataFunc = func(ctx context.Context) (context.Context, error) {
|
||||||
md, ok := metadata.FromIncomingContext(ctx)
|
md, ok := metadata.FromIncomingContext(ctx)
|
||||||
if ok {
|
if !ok {
|
||||||
if _, ok = md.Get(MetadataKey); ok {
|
md = metadata.New(1)
|
||||||
return ctx, nil
|
}
|
||||||
}
|
if _, ok = md.Get(MetadataKey); ok {
|
||||||
|
return ctx, nil
|
||||||
}
|
}
|
||||||
md = metadata.New(1)
|
|
||||||
id, err := uuid.NewRandom()
|
id, err := uuid.NewRandom()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx, err
|
return ctx, err
|
||||||
|
Loading…
Reference in New Issue
Block a user