MCPcopy Create free account
hub / github.com/CPChain/chain / HangSubscription

Method HangSubscription

api/rpc/subscription_test.go:92–106  ·  view source on GitHub ↗

HangSubscription blocks on s.unblockHangSubscription before sending anything.

(ctx context.Context, val int)

Source from the content-addressed store, hash-verified

90// HangSubscription blocks on s.unblockHangSubscription before
91// sending anything.
92func (s *NotificationTestService) HangSubscription(ctx context.Context, val int) (*Subscription, error) {
93 notifier, supported := NotifierFromContext(ctx)
94 if !supported {
95 return nil, ErrNotificationsUnsupported
96 }
97
98 s.gotHangSubscriptionReq <- struct{}{}
99 <-s.unblockHangSubscription
100 subscription := notifier.CreateSubscription()
101
102 go func() {
103 notifier.Notify(subscription.ID, val)
104 }()
105 return subscription, nil
106}
107
108func TestNotifications(t *testing.T) {
109 server := NewServer()

Callers

nothing calls this directly

Calls 3

NotifierFromContextFunction · 0.85
CreateSubscriptionMethod · 0.80
NotifyMethod · 0.45

Tested by

no test coverage detected