add base queue system
This commit is contained in:
parent
4968da25f3
commit
b274d3268f
4 changed files with 82 additions and 2 deletions
|
|
@ -19,6 +19,7 @@ import (
|
|||
"syscall"
|
||||
|
||||
"git.smarteching.com/goffee/core/logger"
|
||||
"github.com/hibiken/asynq"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
|
@ -112,6 +113,14 @@ func (c *Context) GetCookie() (UserCookie, error) {
|
|||
return user, nil
|
||||
}
|
||||
|
||||
func (c *Context) GetQueueClient() *asynq.Client {
|
||||
|
||||
redisAddr := fmt.Sprintf("%v:%v", os.Getenv("REDIS_HOST"), os.Getenv("REDIS_PORT"))
|
||||
client := asynq.NewClient(asynq.RedisClientOpt{Addr: redisAddr})
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
func (c *Context) GetUploadedFile(name string) *UploadedFileInfo {
|
||||
file, fileHeader, err := c.Request.httpRequest.FormFile(name)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue