diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea259ca..7603b46 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/subscription.go b/subscription.go index ce61286..a1131e4 100644 --- a/subscription.go +++ b/subscription.go @@ -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) diff --git a/subscriptions_transport_ws_test.go b/subscriptions_transport_ws_test.go index e2bb921..e1723de 100644 --- a/subscriptions_transport_ws_test.go +++ b/subscriptions_transport_ws_test.go @@ -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 @@ -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) }