Skip to content

Commit

Permalink
check ctxStore
Browse files Browse the repository at this point in the history
  • Loading branch information
sevennt committed Jan 3, 2024
1 parent f457702 commit de69e7f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/egrpc/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ type ctxStoreStruct struct{}

// CtxStoreSet 从ctx中尝试获取ctxStore,并往其中插入kv
func CtxStoreSet(ctx context.Context, k string, v any) {
skv, _ := ctx.Value(ctxStoreStruct{}).(*ctxStore)
skv.kvs[k] = v
skv, ok := ctx.Value(ctxStoreStruct{}).(*ctxStore)
if ok {
skv.kvs[k] = v
}
}

func (c *Container) defaultUnaryServerInterceptor() grpc.UnaryServerInterceptor {
Expand Down

0 comments on commit de69e7f

Please sign in to comment.