Commit 5ed8559
authored
Fix streaming Reader race condition (#55)
* Fix streaming Reader race condition
- There was a race condition between creating a `streaming.Reader` with
`NewReader` and calling its `Subscribe` where events could be consumed
before there is any channel to send them to.
- To fix this, the default behavior is now to only start the reader's
`read` goroutine when `Subscribe` is called after it has inserted a
channel that will receive events.
- Alternatively, there is now an option `WithReaderStartExplicitly`
which will only start the `read` goroutine when the new `Start` is
called allowing multiple calls to `Subscribe` before receiving events.
* Remove option to start explicitly1 parent f5494e1 commit 5ed8559
1 file changed
+11
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
| |||
0 commit comments