rename queues.WithDelay to queues.WithDelaySeconds

This commit is contained in:
syumai 2024-11-10 00:07:29 +09:00
parent c4e9274e73
commit 374d3a8461
3 changed files with 7 additions and 7 deletions

View File

@ -28,8 +28,8 @@ func (o *batchSendOptions) toJS() js.Value {
type BatchSendOption func(*batchSendOptions)
// WithBatchDelay changes the number of seconds to delay the message.
func WithBatchDelay(d time.Duration) BatchSendOption {
// WithBatchDelaySeconds changes the number of seconds to delay the message.
func WithBatchDelaySeconds(d time.Duration) BatchSendOption {
return func(o *batchSendOptions) {
o.DelaySeconds = int(d.Seconds())
}

View File

@ -117,7 +117,7 @@ func TestSend_ContentTypeOption(t *testing.T) {
{
name: "delay",
options: []SendOption{WithDelay(5 * time.Second)},
options: []SendOption{WithDelaySeconds(5 * time.Second)},
expectedDelaySec: 5,
expectedContentType: "json",
},
@ -200,11 +200,11 @@ func TestSendBatch_Options(t *testing.T) {
}
var batch []*BatchMessage = []*BatchMessage{
NewBatchMessage("hello"),
NewTextBatchMessage("hello"),
}
producer := validatingProducer(t, validation)
err := producer.SendBatch(batch, WithBatchDelay(5*time.Second))
err := producer.SendBatch(batch, WithBatchDelaySeconds(5*time.Second))
if err != nil {
t.Fatalf("SendBatch failed: %v", err)
}

View File

@ -30,8 +30,8 @@ func (o *sendOptions) toJS() js.Value {
type SendOption func(*sendOptions)
// WithDelay changes the number of seconds to delay the message.
func WithDelay(d time.Duration) SendOption {
// WithDelaySeconds changes the number of seconds to delay the message.
func WithDelaySeconds(d time.Duration) SendOption {
return func(o *sendOptions) {
o.DelaySeconds = int(d.Seconds())
}