mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-08 18:16:59 +00:00
Fix data race in TestCorrectStreamWakeup
(#2334)
This commit is contained in:
parent
b8c97431b9
commit
f299f97e0a
@ -165,9 +165,9 @@ func TestCorrectStreamWakeup(t *testing.T) {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-streamone.signalChannel:
|
case <-streamone.ch():
|
||||||
awoken <- "one"
|
awoken <- "one"
|
||||||
case <-streamtwo.signalChannel:
|
case <-streamtwo.ch():
|
||||||
awoken <- "two"
|
awoken <- "two"
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -118,6 +118,12 @@ func (s *UserDeviceStream) TimeOfLastNonEmpty() time.Time {
|
|||||||
return s.timeOfLastChannel
|
return s.timeOfLastChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *UserDeviceStream) ch() <-chan struct{} {
|
||||||
|
s.lock.Lock()
|
||||||
|
defer s.lock.Unlock()
|
||||||
|
return s.signalChannel
|
||||||
|
}
|
||||||
|
|
||||||
// GetSyncPosition returns last sync position which the UserStream was
|
// GetSyncPosition returns last sync position which the UserStream was
|
||||||
// notified about
|
// notified about
|
||||||
func (s *UserDeviceStreamListener) GetSyncPosition() types.StreamingToken {
|
func (s *UserDeviceStreamListener) GetSyncPosition() types.StreamingToken {
|
||||||
|
Loading…
Reference in New Issue
Block a user