99designs / 99designs/gqlgen

Subscription use channel of pointer of model, may cause thread-unsafe issue?

Đang mở
#1,229 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
10.8k
Fork
1.3k
Merge trung bình
2 ngày 36 phút
Pull request đã merge (30 ngày)
26

Mô tả

### What happened?
The generated subscription, like
```go
func (r *subscriptionResolver) StatusUpdated(ctx context.Context, udid string) (<-chan *model.Status, error) {
...
}
```

using type of channel of <- chan *model.Status,

when passing pointer of model.Status to multiple goroutine, I think it may cause thread-unsafe problem.
### What did you expect?
`<-chan *model.Status` to `<- chan model.Status`
```go
func (r *subscriptionResolver) StatusUpdated(ctx context.Context, id string) (<-chan model.Status, error) {
...
}
```

### Minimal graphql.schema and models to reproduce
```
type Subscription {
statusUpdated(id: String!) : Status!
}
```
### versions
- `gqlgen version`?
v0.11.3-dev
- `go version`?
go version go1.14.3 linux/amd64
- dep or go modules?
go modules

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.