Fix memory backend test and WithOptions()

This commit is contained in:
Adriano Caloiaro 2023-02-24 08:33:01 -07:00
parent 67e83aa677
commit 145c9df2fd
No known key found for this signature in database
GPG key ID: C2BC56DE73CE3F75
3 changed files with 5 additions and 14 deletions

View file

@ -1,13 +1,8 @@
---
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
@ -36,7 +31,7 @@ jobs:
# args: --issues-exit-code=0
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
only-new-issues: true
# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.

View file

@ -111,11 +111,7 @@ func TestMemeoryBackendConfiguration(t *testing.T) {
handler := NewHandler(func(ctx context.Context) (err error) {
time.Sleep(100 * time.Millisecond)
return
})
handler = handler.
WithOption(HandlerConcurrency(1)).
WithOption(MaxQueueCapacity(1))
}, HandlerConcurrency(1), MaxQueueCapacity(1))
nq.Listen(ctx, queue, handler)

View file

@ -94,9 +94,9 @@ type Handler struct {
type HandlerOption func(w *Handler)
// WithOptions sets one or more options on handler
func (h Handler) WithOptions(opts ...HandlerOption) {
func (h *Handler) WithOptions(opts ...HandlerOption) {
for _, opt := range opts {
opt(&h)
opt(h)
}
}