Skip to content

Commit cfbdc45

Browse files
committed
chore: update
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
1 parent 5a0c106 commit cfbdc45

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

Diff for: job/job.go

-10
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ func (m *Message) Encode() []byte {
4646

4747
func NewMessage(m core.QueuedMessage, opts ...Option) *Message {
4848
o := NewOptions(opts...)
49-
// Loop through each option
50-
for _, opt := range opts {
51-
// Call the option giving the instantiated
52-
opt.Apply(o)
53-
}
5449

5550
return &Message{
5651
RetryCount: o.retryCount,
@@ -62,11 +57,6 @@ func NewMessage(m core.QueuedMessage, opts ...Option) *Message {
6257

6358
func NewTask(task TaskFunc, opts ...Option) *Message {
6459
o := NewOptions(opts...)
65-
// Loop through each option
66-
for _, opt := range opts {
67-
// Call the option giving the instantiated
68-
opt.Apply(o)
69-
}
7060

7161
return &Message{
7262
Timeout: o.timeout,

Diff for: job/option.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ type Options struct {
1010

1111
// An Option configures a mutex.
1212
type Option interface {
13-
Apply(*Options)
13+
apply(*Options)
1414
}
1515

1616
// OptionFunc is a function that configures a job.
1717
type OptionFunc func(*Options)
1818

19-
// Apply calls f(option)
20-
func (f OptionFunc) Apply(option *Options) {
19+
// apply calls f(option)
20+
func (f OptionFunc) apply(option *Options) {
2121
f(option)
2222
}
2323

@@ -31,7 +31,7 @@ func NewOptions(opts ...Option) *Options {
3131
// Loop through each option
3232
for _, opt := range opts {
3333
// Call the option giving the instantiated
34-
opt.Apply(o)
34+
opt.apply(o)
3535
}
3636

3737
return o

0 commit comments

Comments
 (0)