Skip to content

Commit 7cc3ef8

Browse files
committed
copy edit
1 parent 8227901 commit 7cc3ef8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

messagebatch.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import (
88
)
99

1010
// MessageBatch allows a user to batch related messages and then publish them at
11-
// once. This allows the Scheduler to define an order for the outgoing RPCs.
11+
// once. This allows the Scheduler to define an order for outgoing RPCs.
1212
// This helps bandwidth constrained peers.
1313
type MessageBatch struct {
1414
Scheduler RPCScheduler
1515
messages []*Message
1616
}
1717

18-
// RPCScheduler is the publishing strategy publishing a set of RPCs.
18+
// RPCScheduler schedules outgoing RPCs.
1919
type RPCScheduler interface {
20-
// AddRPC adds an RPC to the strategy.
20+
// AddRPC adds an RPC to the scheduler.
2121
AddRPC(peer peer.ID, msgID string, rpc *RPC)
22-
// All returns an ordered iterator of RPCs to publish.
22+
// All returns an ordered iterator of RPCs.
2323
All() iter.Seq2[peer.ID, *RPC]
2424
}
2525

pubsub.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1390,15 +1390,15 @@ func (p *PubSub) PublishBatch(batch *MessageBatch) error {
13901390
return fmt.Errorf("pubsub router is not a BatchPublisher")
13911391
}
13921392

1393-
// Copy the batch to avoid the footgun of reusing strategy state across batches
1393+
// Copy the batch to avoid the footgun of reusing scheduler state across batches
13941394
var copy MessageBatch
13951395
copy.Scheduler = batch.Scheduler
13961396
copy.messages = batch.messages
13971397
batch.Scheduler = nil
13981398
batch.messages = nil
13991399

14001400
if copy.Scheduler == nil {
1401-
// Default to RarestFirstStrategy
1401+
// Default to Rarest first
14021402
copy.Scheduler = &RarestFirstRPCScheduler{}
14031403
}
14041404

0 commit comments

Comments
 (0)