refactor(rabbitmq): remove redundant publish mutex

This commit is contained in:
kk10
2026-11-14 18:20:08 +03:00
parent 425ffc6182
commit 4dbbd65bcf
+1 -5
View File
@@ -3,7 +3,6 @@ package rabbitmq
import (
"context"
"errors"
"sync"
"time"
amqp "github.com/rabbitmq/amqp091-go"
@@ -22,7 +21,6 @@ type Client struct {
conn *amqp.Connection
channel *amqp.Channel
returns <-chan amqp.Return
mu sync.Mutex
}
func New(url string) (*Client, error) {
@@ -54,10 +52,8 @@ func New(url string) (*Client, error) {
}, nil
}
// Publish must not be called concurrently on the same client.
func (c *Client) Publish(ctx context.Context, messageID string, body []byte) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ctx.Err(); err != nil {
return err
}