diff --git a/README.md b/README.md index ccfa301..f2e73d6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Go Reference](https://pkg.go.dev/badge/github.com/mdawar/pubsub.svg)](https://pkg.go.dev/github.com/mdawar/pubsub) [![Tests](https://github.com/mdawar/pubsub/actions/workflows/test.yml/badge.svg)](https://github.com/mdawar/pubsub/actions/workflows/test.yml) -`pubsub` is a simple and generic **topic-based** **publish/subscribe** library for in-process communication in **Go**. +`pubsub` is a simple and generic **topic-based** **publish/subscribe** package for in-process communication in **Go**. ## Installation diff --git a/broker.go b/broker.go index 9883f4a..deddb94 100644 --- a/broker.go +++ b/broker.go @@ -1,3 +1,4 @@ +// Package pubsub provides a generic and concurrency-safe, topic-based publish/subscribe library for in-process communication. package pubsub import ( @@ -139,9 +140,8 @@ func (b *Broker[T, P]) removeSubscription(sub <-chan Message[T, P], topic T) { // This method will block if any of the subscription channels buffer is full. // This can be used to guarantee message delivery. // -// Publishing will be canceled if the context is canceled or the deadline is exceeded. -// -// The returned error will be error returned by [context.Context.Err]. +// Publishing will be canceled if the context is canceled or the deadline is exceeded +// and the value of [context.Context.Err] will be returned. func (b *Broker[T, P]) Publish(ctx context.Context, topic T, payload P) error { b.mu.RLock() defer b.mu.RUnlock() diff --git a/broker_test.go b/broker_test.go index 16af47d..aa64214 100644 --- a/broker_test.go +++ b/broker_test.go @@ -215,7 +215,7 @@ func TestBrokerNumTopicsWithSubscribersOnSameTopic(t *testing.T) { lastSubIndex := len(subs) - 1 - // Remove all of the subscriptons and keep 1. + // Remove all of the subscriptions and keep 1. for _, sub := range subs[:lastSubIndex] { broker.Unsubscribe(sub, topic) assertTopics(1)