Open kjk opened 5 years ago
Try logging all the previous values that you go there. It might have called this twice? Or there was an error and it retired?
It looks like (sometimes) we don't get the first expected value, created before subscription.Run
.
In here: https://github.com/ravendb/ravendb-go-client/blob/master/tests/subscriptions_basic_test.go#L271
And: https://github.com/ravendb/ravendb-go-client/blob/master/subscription_worker.go#L427
You are putting the batch
into a channel, but it looks like this instance is being reused, so you are getting data races.
If this is a common setup in Go, this is probably a real pitfall and we need to make sure that we won't be re-using this instance.
For that reason the callback receives a copy of SubscriptionBatch: https://github.com/ravendb/ravendb-go-client/blob/master/subscription_worker.go#L444
But you are passing the Item
instance, isn't that mutable?
.Items
gets re-created from scratch in each iteration in https://sourcegraph.com/github.com/ravendb/ravendb-go-client@master/-/blob/subscription_batch.go#L87 called from https://sourcegraph.com/github.com/ravendb/ravendb-go-client@2c2cde5258d42e531d03f95fa98713cb6e1b8135/-/blob/subscription_worker.go#L437
Okay, make sense.
When you check the logs, see if you can also log what comes from the network. I think this is a Go client problem, not a server one
https://ci.appveyor.com/project/ravendb/ravendb-go-client/builds/23144627/job/ge467894jiqskbqv?fullLog=true#L4358
Could be just networking issue with the machine.