fixes from Bucky's review 2

This commit is contained in:
Anton Kaliaev
2017-11-02 13:12:40 -05:00
parent 7c3cf316f1
commit fcdd30b2d3
4 changed files with 13 additions and 17 deletions

View File

@ -59,11 +59,9 @@ func (b *EventBus) UnsubscribeAll(ctx context.Context, subscriber string) error
}
func (b *EventBus) Publish(eventType string, eventData TMEventData) error {
if b.pubsub != nil {
// no explicit deadline for publishing events
ctx := context.Background()
b.pubsub.PublishWithTags(ctx, eventData, map[string]interface{}{EventTypeKey: eventType})
}
// no explicit deadline for publishing events
ctx := context.Background()
b.pubsub.PublishWithTags(ctx, eventData, map[string]interface{}{EventTypeKey: eventType})
return nil
}
@ -82,11 +80,9 @@ func (b *EventBus) PublishEventVote(vote EventDataVote) error {
}
func (b *EventBus) PublishEventTx(tx EventDataTx) error {
if b.pubsub != nil {
// no explicit deadline for publishing events
ctx := context.Background()
b.pubsub.PublishWithTags(ctx, TMEventData{tx}, map[string]interface{}{EventTypeKey: EventTx, TxHashKey: fmt.Sprintf("%X", tx.Tx.Hash())})
}
// no explicit deadline for publishing events
ctx := context.Background()
b.pubsub.PublishWithTags(ctx, TMEventData{tx}, map[string]interface{}{EventTypeKey: EventTx, TxHashKey: fmt.Sprintf("%X", tx.Tx.Hash())})
return nil
}