mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
rename queues.WithDelay to queues.WithDelaySeconds
This commit is contained in:
parent
c4e9274e73
commit
374d3a8461
@ -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())
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user