-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(api,ssh,pkg): abstract internal client's
asynq.Client
To support the new worker package, we are replacing the direct usage of `asynq.Client` with the new `worker.Client` (#3979). The client initialization process has also been updated to return an error if the worker cannot be created.
- Loading branch information
1 parent
f4c3992
commit 8819a37
Showing
11 changed files
with
151 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package internalclient | ||
|
||
import "github.com/shellhub-io/shellhub/pkg/worker/asynq" | ||
|
||
type clientOption func(c *client) error | ||
|
||
func WithAsynqWorker(redisURI string) clientOption { //nolint:revive | ||
return func(c *client) error { | ||
asynqClient, err := asynq.NewClient(redisURI) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
c.worker = asynqClient | ||
|
||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.