Skip to content

Store the subID on the routine that detects it #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions core/go/internal/groupmgr/rpc_eventstreams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ func TestRPCEventListenerE2ENack(t *testing.T) {
err = wsc.Send(ctx, req)
require.NoError(t, err)

subIDChan := make(chan string)
unSubChan := make(chan bool)
sentNack := false
messages := make(chan *pldapi.PrivacyGroupMessage)
Expand All @@ -291,7 +290,10 @@ func TestRPCEventListenerE2ENack(t *testing.T) {

switch rpcID {
case subReqID: // Subscribe reply
subIDChan <- rpcPayload.Result.StringValue()
subIDStr := rpcPayload.Result.StringValue()
_, err = uuid.Parse(subIDStr)
require.NoError(t, err)
subID.Store(&subIDStr)
for subID.Load() == nil { // wait for subID to be set
time.Sleep(10 * time.Millisecond)
}
Expand Down Expand Up @@ -337,15 +339,10 @@ func TestRPCEventListenerE2ENack(t *testing.T) {
})
require.NoError(t, err)

subIDStr := <-subIDChan
_, err = uuid.Parse(subIDStr)
require.NoError(t, err)
subID.Store(&subIDStr)

// We get it on redelivery
<-messages

reqID, req := rpcTestRequest("pgroup_unsubscribe", subIDStr)
reqID, req := rpcTestRequest("pgroup_unsubscribe", *subID.Load())
unSubReqID.Store(reqID)
err = wsc.Send(ctx, req)
require.NoError(t, err)
Expand Down
Loading