mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix publisher
This commit is contained in:
parent
fa59a5d67e
commit
026c54a9bb
|
@ -25,7 +25,10 @@ func doPublish(publisher *pub_client.TopicPublisher, id int) {
|
||||||
// Simulate publishing a message
|
// Simulate publishing a message
|
||||||
key := []byte(fmt.Sprintf("key-%d-%d", id, i))
|
key := []byte(fmt.Sprintf("key-%d-%d", id, i))
|
||||||
value := []byte(fmt.Sprintf("value-%d-%d", id, i))
|
value := []byte(fmt.Sprintf("value-%d-%d", id, i))
|
||||||
publisher.Publish(key, value) // Call your publisher function here
|
if err := publisher.Publish(key, value); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
break
|
||||||
|
}
|
||||||
// println("Published", string(key), string(value))
|
// println("Published", string(key), string(value))
|
||||||
}
|
}
|
||||||
elapsed := time.Since(startTime)
|
elapsed := time.Since(startTime)
|
||||||
|
|
|
@ -12,7 +12,7 @@ func (p *TopicPublisher) Publish(key, value []byte) error {
|
||||||
if hashKey < 0 {
|
if hashKey < 0 {
|
||||||
hashKey = -hashKey
|
hashKey = -hashKey
|
||||||
}
|
}
|
||||||
publishClient, found := p.partition2Broker.Floor(hashKey, hashKey)
|
publishClient, found := p.partition2Broker.Floor(hashKey+1, hashKey+1)
|
||||||
if !found {
|
if !found {
|
||||||
return fmt.Errorf("no broker found for key %d", hashKey)
|
return fmt.Errorf("no broker found for key %d", hashKey)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue