mirror of
https://github.com/acaloiaro/neoq
synced 2026-07-21 18:29:08 +00:00
Fix memory backend test and WithOptions()
This commit is contained in:
parent
67e83aa677
commit
145c9df2fd
3 changed files with 5 additions and 14 deletions
9
.github/workflows/golangci-lint.yml
vendored
9
.github/workflows/golangci-lint.yml
vendored
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
4
neoq.go
4
neoq.go
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue