diff --git a/cloudflare/queues/batchsendoptions.go b/cloudflare/queues/batchsendoptions.go index 97abd6d..54815bc 100644 --- a/cloudflare/queues/batchsendoptions.go +++ b/cloudflare/queues/batchsendoptions.go @@ -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()) } diff --git a/cloudflare/queues/producer_test.go b/cloudflare/queues/producer_test.go index fc00a93..2903f9d 100644 --- a/cloudflare/queues/producer_test.go +++ b/cloudflare/queues/producer_test.go @@ -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) } diff --git a/cloudflare/queues/sendoptions.go b/cloudflare/queues/sendoptions.go index c6501e9..bc3bd85 100644 --- a/cloudflare/queues/sendoptions.go +++ b/cloudflare/queues/sendoptions.go @@ -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()) }