Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test of internal/worker/queue_option #613

Merged
merged 3 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/worker/queue_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/vdaas/vald/internal/timeutil"
)

// QueueOption represents the functional option for queue.
type QueueOption func(q *queue) error

var (
Expand All @@ -32,6 +33,7 @@ var (
}
)

// WithQueueBuffer returns the option to set the buffer for queue.
func WithQueueBuffer(buffer int) QueueOption {
return func(q *queue) error {
if buffer > 0 {
Expand All @@ -41,6 +43,7 @@ func WithQueueBuffer(buffer int) QueueOption {
}
}

// WithQueueErrGroup returns the options to set the eg for queue.
func WithQueueErrGroup(eg errgroup.Group) QueueOption {
return func(q *queue) error {
if eg != nil {
Expand All @@ -50,6 +53,8 @@ func WithQueueErrGroup(eg errgroup.Group) QueueOption {
}
}

// WithQueueCheckDuration returns the option to set the qcdur for queue.
// If dur is invalid string, it returns errror.
func WithQueueCheckDuration(dur string) QueueOption {
return func(q *queue) error {
if len(dur) == 0 {
Expand Down
Loading