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) type BatchSendOption func(*batchSendOptions)
// WithBatchDelay changes the number of seconds to delay the message. // WithBatchDelaySeconds changes the number of seconds to delay the message.
func WithBatchDelay(d time.Duration) BatchSendOption { func WithBatchDelaySeconds(d time.Duration) BatchSendOption {
return func(o *batchSendOptions) { return func(o *batchSendOptions) {
o.DelaySeconds = int(d.Seconds()) o.DelaySeconds = int(d.Seconds())
} }

View File

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

View File

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