mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 02:23:10 -06:00
Don't loop forever; close channel
This commit is contained in:
parent
ed183b1a2a
commit
63a319bce7
|
|
@ -129,7 +129,12 @@ func runTests(baseURL, branchName string) error {
|
||||||
go func() {
|
go func() {
|
||||||
syncClient := users[0].client
|
syncClient := users[0].client
|
||||||
since := ""
|
since := ""
|
||||||
for {
|
for len(wantEventIDs) > 0 {
|
||||||
|
select {
|
||||||
|
case <-doneCh:
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
syncResp, err := syncClient.SyncRequest(1000, since, "1", false, "")
|
syncResp, err := syncClient.SyncRequest(1000, since, "1", false, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
|
|
@ -140,17 +145,16 @@ func runTests(baseURL, branchName string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
delete(wantEventIDs, ev.ID)
|
delete(wantEventIDs, ev.ID)
|
||||||
if len(wantEventIDs) == 0 {
|
|
||||||
close(doneCh)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
since = syncResp.NextBatch
|
since = syncResp.NextBatch
|
||||||
}
|
}
|
||||||
|
close(doneCh)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(time.Second * 10):
|
case <-time.After(time.Second * 10):
|
||||||
|
close(doneCh)
|
||||||
return fmt.Errorf("failed to receive all expected messages: %+v", wantEventIDs)
|
return fmt.Errorf("failed to receive all expected messages: %+v", wantEventIDs)
|
||||||
case <-doneCh:
|
case <-doneCh:
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue