mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
wrap errors
This commit is contained in:
@@ -103,12 +103,12 @@ func (s *Service) PublishToTopic(ctx context.Context, topic string, data []byte,
|
|||||||
func (s *Service) addToBatch(ctx context.Context, batch *pubsub.MessageBatch, topic string, data []byte, opts ...pubsub.PubOpt) error {
|
func (s *Service) addToBatch(ctx context.Context, batch *pubsub.MessageBatch, topic string, data []byte, opts ...pubsub.PubOpt) error {
|
||||||
topicHandle, err := s.JoinTopic(topic)
|
topicHandle, err := s.JoinTopic(topic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("joining topic: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for at least 1 peer to be available to receive the published message.
|
// Wait for at least 1 peer to be available to receive the published message.
|
||||||
for {
|
for {
|
||||||
if flags.Get().MinimumSyncPeers == 0 || len(topicHandle.ListPeers()) > 0 {
|
if flags.Get().MinimumSyncPeers == 0 || len(topicHandle.ListPeers()) > 0 {
|
||||||
return topicHandle.AddToBatch(ctx, batch, data, opts...)
|
return topicHandle.AddToBatch(ctx, batch, data, opts...)
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
|
|||||||
Reference in New Issue
Block a user