correct spelling to US english (#6077)

This commit is contained in:
Callum Waters
2021-02-11 18:59:18 +01:00
committed by GitHub
parent 059d42866c
commit 162f67cf26
61 changed files with 392 additions and 392 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ func (bz *HexBytes) UnmarshalJSON(data []byte) error {
return nil
}
// Bytes fulfils various interfaces in light-client, etc...
// Bytes fulfills various interfaces in light-client, etc...
func (bz HexBytes) Bytes() []byte {
return bz
}
+1 -1
View File
@@ -13,7 +13,7 @@ func TestEventCache_Flush(t *testing.T) {
require.NoError(t, err)
err = evsw.AddListenerForEvent("nothingness", "", func(data EventData) {
// Check we are not initialising an empty buffer full of zeroed eventInfos in the EventCache
// Check we are not initializing an empty buffer full of zeroed eventInfos in the EventCache
require.FailNow(t, "We should never receive a message on this switch since none are fired")
})
require.NoError(t, err)
+1 -1
View File
@@ -27,7 +27,7 @@
// select {
// case msg <- subscription.Out():
// // handle msg.Data() and msg.Events()
// case <-subscription.Cancelled():
// case <-subscription.Canceled():
// return subscription.Err()
// }
// }
+9 -9
View File
@@ -59,7 +59,7 @@ func TestSubscribe(t *testing.T) {
select {
case <-published:
assertReceive(t, "Quicksilver", subscription.Out())
assertCancelled(t, subscription, pubsub.ErrOutOfCapacity)
assertCanceled(t, subscription, pubsub.ErrOutOfCapacity)
case <-time.After(3 * time.Second):
t.Fatal("Expected Publish(Asylum) not to block")
}
@@ -146,7 +146,7 @@ func TestSlowClientIsRemovedWithErrOutOfCapacity(t *testing.T) {
err = s.Publish(ctx, "Viper")
require.NoError(t, err)
assertCancelled(t, subscription, pubsub.ErrOutOfCapacity)
assertCanceled(t, subscription, pubsub.ErrOutOfCapacity)
}
func TestDifferentClients(t *testing.T) {
@@ -298,7 +298,7 @@ func TestUnsubscribe(t *testing.T) {
require.NoError(t, err)
assert.Zero(t, len(subscription.Out()), "Should not receive anything after Unsubscribe")
assertCancelled(t, subscription, pubsub.ErrUnsubscribed)
assertCanceled(t, subscription, pubsub.ErrUnsubscribed)
}
func TestClientUnsubscribesTwice(t *testing.T) {
@@ -373,8 +373,8 @@ func TestUnsubscribeAll(t *testing.T) {
assert.Zero(t, len(subscription1.Out()), "Should not receive anything after UnsubscribeAll")
assert.Zero(t, len(subscription2.Out()), "Should not receive anything after UnsubscribeAll")
assertCancelled(t, subscription1, pubsub.ErrUnsubscribed)
assertCancelled(t, subscription2, pubsub.ErrUnsubscribed)
assertCanceled(t, subscription1, pubsub.ErrUnsubscribed)
assertCanceled(t, subscription2, pubsub.ErrUnsubscribed)
}
func TestBufferCapacity(t *testing.T) {
@@ -431,7 +431,7 @@ func benchmarkNClients(n int, b *testing.B) {
select {
case <-subscription.Out():
continue
case <-subscription.Cancelled():
case <-subscription.Canceled():
return
}
}
@@ -472,7 +472,7 @@ func benchmarkNClientsOneQuery(n int, b *testing.B) {
select {
case <-subscription.Out():
continue
case <-subscription.Cancelled():
case <-subscription.Canceled():
return
}
}
@@ -500,8 +500,8 @@ func assertReceive(t *testing.T, expected interface{}, ch <-chan pubsub.Message,
}
}
func assertCancelled(t *testing.T, subscription *pubsub.Subscription, err error) {
_, ok := <-subscription.Cancelled()
func assertCanceled(t *testing.T, subscription *pubsub.Subscription, err error) {
_, ok := <-subscription.Canceled()
assert.False(t, ok)
assert.Equal(t, err, subscription.Err())
}
+10 -10
View File
@@ -23,16 +23,16 @@ var (
type Subscription struct {
out chan Message
cancelled chan struct{}
mtx tmsync.RWMutex
err error
canceled chan struct{}
mtx tmsync.RWMutex
err error
}
// NewSubscription returns a new subscription with the given outCapacity.
func NewSubscription(outCapacity int) *Subscription {
return &Subscription{
out: make(chan Message, outCapacity),
cancelled: make(chan struct{}),
out: make(chan Message, outCapacity),
canceled: make(chan struct{}),
}
}
@@ -43,13 +43,13 @@ func (s *Subscription) Out() <-chan Message {
return s.out
}
// Cancelled returns a channel that's closed when the subscription is
// Canceled returns a channel that's closed when the subscription is
// terminated and supposed to be used in a select statement.
func (s *Subscription) Cancelled() <-chan struct{} {
return s.cancelled
func (s *Subscription) Canceled() <-chan struct{} {
return s.canceled
}
// Err returns nil if the channel returned by Cancelled is not yet closed.
// Err returns nil if the channel returned by Canceled is not yet closed.
// If the channel is closed, Err returns a non-nil error explaining why:
// - ErrUnsubscribed if the subscriber choose to unsubscribe,
// - ErrOutOfCapacity if the subscriber is not pulling messages fast enough
@@ -66,7 +66,7 @@ func (s *Subscription) cancel(err error) {
s.mtx.Lock()
s.err = err
s.mtx.Unlock()
close(s.cancelled)
close(s.canceled)
}
// Message glues data and events together.