Skip to content

Commit

Permalink
Merge branch 'master' into graphql-operation-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed May 10, 2024
2 parents 77f1576 + 0fc7dc5 commit 806f248
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ jobs:
cd ./example/hasura
docker-compose up -d
- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
only-new-issues: true
skip-cache: false
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=120s
- name: Run Go unit tests for example/subscription
run: |
cd example/subscription
Expand Down
5 changes: 5 additions & 0 deletions subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ func (sc *SubscriptionClient) GetContext() context.Context {
return sc.getContext().GetContext()
}

// GetSubscriptions get the list of active subscriptions
func (sc *SubscriptionClient) GetSubscriptions() map[string]Subscription {
return sc.getContext().GetSubscriptions()
}

// GetSubscription get the subscription state by id
func (sc *SubscriptionClient) GetSubscription(id string) *Subscription {
return sc.getContext().GetSubscription(id)
Expand Down
4 changes: 2 additions & 2 deletions subscriptions_transport_ws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestSubscription_closeThenRun(t *testing.T) {
bulkSubscribe()

go func() {
length := subscriptionClient.getContext().GetSubscriptionsLength(nil)
length := len(subscriptionClient.GetSubscriptions())
if length != 2 {
t.Errorf("unexpected subscription client. got: %d, want: 2", length)
return
Expand All @@ -220,7 +220,7 @@ func TestSubscription_closeThenRun(t *testing.T) {
}()

time.Sleep(3 * time.Second)
length := subscriptionClient.getContext().GetSubscriptionsLength(nil)
length := len(subscriptionClient.GetSubscriptions())
if length != 2 {
t.Fatalf("unexpected subscription client after restart. got: %d, want: 2, subscriptions: %+v", length, subscriptionClient.context.subscriptions)
}
Expand Down

0 comments on commit 806f248

Please sign in to comment.