[#1243] nats: Fix comments

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-03-15 20:49:42 +03:00 committed by Alex Vanin
parent 7ebeb4c89b
commit d02720c910

View file

@ -38,19 +38,19 @@ type Option func(*opts)
var errConnIsClosed = errors.New("connection to the server is closed") var errConnIsClosed = errors.New("connection to the server is closed")
// Notify sends object address's string representation to the provided topic. // Notify sends object address's string representation to the provided topic.
// Uses first 4 bytes of object ID as a message ID to support 'exactly once message' // Uses first 4 bytes of object ID as a message ID to support 'exactly once'
// delivery. // message delivery.
// //
// Returns error only if: // Returns error only if:
// 1. underlying connection was closed and has not established again; // 1. underlying connection was closed and has not been established again;
// 2. NATS server could not respond that is has saved the message. // 2. NATS server could not respond that it has saved the message.
func (n *Writer) Notify(topic string, address *addressSDK.Address) error { func (n *Writer) Notify(topic string, address *addressSDK.Address) error {
if !n.nc.IsConnected() { if !n.nc.IsConnected() {
return errConnIsClosed return errConnIsClosed
} }
// use first 4 byte of the encoded string as // use first 4 byte of the encoded string as
// message ID for the exactly-once delivery // message ID for the 'exactly once' delivery
messageID := address.ObjectID().String()[:4] messageID := address.ObjectID().String()[:4]
// check if the stream was previously created // check if the stream was previously created