broker: add profiling

This commit is contained in:
Chris Lu
2020-04-19 03:03:40 -07:00
parent d278b4c228
commit 71ffb98475
8 changed files with 83 additions and 67 deletions

View File

@@ -16,6 +16,10 @@ import (
func (broker *MessageBroker) appendToFile(targetFile string, topicConfig *messaging_pb.TopicConfiguration, data []byte) error {
if topicConfig.IsTransient {
return nil
}
assignResult, uploadResult, err2 := broker.assignAndUpload(topicConfig, data)
if err2 != nil {
return err2

View File

@@ -23,7 +23,7 @@ func (broker *MessageBroker) Publish(stream messaging_pb.SeaweedMessaging_Publis
// TODO look it up
topicConfig := &messaging_pb.TopicConfiguration{
IsTransient: true,
}
// send init response

View File

@@ -23,12 +23,12 @@ func NewMessagingClient(bootstrapBrokers []string) (*MessagingClient, error) {
return nil, err
}
util.OnInterrupt(func() {
grpcConnection.Close()
})
return &MessagingClient{
bootstrapBrokers: bootstrapBrokers,
grpcConnection: grpcConnection,
}, nil
}
func (mc *MessagingClient) Shutdown() {
mc.grpcConnection.Close()
}

View File

@@ -69,8 +69,7 @@ func (p *Publisher) Publish(m *messaging_pb.RawData) error {
}
func (p *Publisher) Shutdown() {
p.publishClient.CloseSend()
func (p *Publisher) Close() error {
return p.publishClient.CloseSend()
}

View File

@@ -59,7 +59,3 @@ func (s *Subscriber) Subscribe(processFn func(m *messaging_pb.Message)) error {
processFn(resp.Data)
}
}
func (s *Subscriber) Shutdown() {
s.subscriberClient.CloseSend()
}