Compare commits
2 Commits
47f14f94ab
...
74c9bf36fd
Author | SHA1 | Date | |
---|---|---|---|
74c9bf36fd | |||
3ecd10b367 |
@ -29,7 +29,7 @@ func Init(addr, username, password string, database int) {
|
||||
|
||||
var cli *asynq.Client
|
||||
|
||||
func Client() *asynq.Client {
|
||||
func GetClient() *asynq.Client {
|
||||
onceCli.Do(func() {
|
||||
cli = asynq.NewClient(redisOpt)
|
||||
})
|
||||
@ -38,7 +38,7 @@ func Client() *asynq.Client {
|
||||
|
||||
var svc *asynq.Server
|
||||
|
||||
func ServerWithArgs(concurrency int, fn asynq.ErrorHandlerFunc) *asynq.Server {
|
||||
func GetServerWithArgs(concurrency int, fn asynq.ErrorHandlerFunc) *asynq.Server {
|
||||
onceSvc.Do(func() {
|
||||
svc = asynq.NewServer(
|
||||
redisOpt,
|
||||
@ -51,7 +51,7 @@ func ServerWithArgs(concurrency int, fn asynq.ErrorHandlerFunc) *asynq.Server {
|
||||
return svc
|
||||
}
|
||||
|
||||
func ServerWithConfig(cfg asynq.Config) *asynq.Server {
|
||||
func GetServerWithConfig(cfg asynq.Config) *asynq.Server {
|
||||
onceSvc.Do(func() {
|
||||
svc = asynq.NewServer(
|
||||
redisOpt,
|
||||
@ -61,7 +61,7 @@ func ServerWithConfig(cfg asynq.Config) *asynq.Server {
|
||||
return svc
|
||||
}
|
||||
|
||||
func Server() *asynq.Server {
|
||||
func GetServer() *asynq.Server {
|
||||
onceSvc.Do(func() {
|
||||
svc = asynq.NewServer(
|
||||
redisOpt,
|
||||
|
30
gqueue/wrapper.go
Normal file
30
gqueue/wrapper.go
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// wrapper.go
|
||||
// Copyright (C) 2023 tiglog <me@tiglog.com>
|
||||
//
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package gqueue
|
||||
|
||||
import "github.com/hibiken/asynq"
|
||||
|
||||
type Task = asynq.Task
|
||||
type Client = asynq.Client
|
||||
type Server = asynq.Server
|
||||
|
||||
var GetRetryCount = asynq.GetRetryCount
|
||||
var GetTaskID = asynq.GetTaskID
|
||||
var GetQueueName = asynq.GetQueueName
|
||||
var GetMaxRetry = asynq.GetMaxRetry
|
||||
|
||||
var ProcessIn = asynq.ProcessIn
|
||||
var ProcessAt = asynq.ProcessAt
|
||||
|
||||
var MaxRetry = asynq.MaxRetry
|
||||
var Timeout = asynq.Timeout
|
||||
var SkipRetry = asynq.SkipRetry
|
||||
|
||||
var NewTask = asynq.NewTask
|
||||
var NewServeMux = asynq.NewServeMux
|
||||
var NewClient = asynq.NewClient
|
18
gweb/gin.go
18
gweb/gin.go
@ -16,26 +16,8 @@ import (
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Engine = gin.Engine
|
||||
|
||||
type Context = gin.Context
|
||||
|
||||
type H = gin.H
|
||||
|
||||
const (
|
||||
ReleaseMode = gin.ReleaseMode
|
||||
DebugMode = gin.DebugMode
|
||||
TestMode = gin.TestMode
|
||||
)
|
||||
|
||||
var New = gin.New
|
||||
var SetMode = gin.SetMode
|
||||
var Mode = gin.Mode
|
||||
|
||||
func RunWeb(app *Engine, addr string) {
|
||||
if addr[0] == ':' {
|
||||
addr = "127.0.0.1" + addr
|
||||
|
26
gweb/wrapper.go
Normal file
26
gweb/wrapper.go
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// wrapper.go
|
||||
// Copyright (C) 2023 tiglog <me@tiglog.com>
|
||||
//
|
||||
// Distributed under terms of the MIT license.
|
||||
//
|
||||
|
||||
package gweb
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type Engine = gin.Engine
|
||||
|
||||
type Context = gin.Context
|
||||
|
||||
type H = gin.H
|
||||
|
||||
const (
|
||||
ReleaseMode = gin.ReleaseMode
|
||||
DebugMode = gin.DebugMode
|
||||
TestMode = gin.TestMode
|
||||
)
|
||||
|
||||
var New = gin.New
|
||||
var SetMode = gin.SetMode
|
||||
var Mode = gin.Mode
|
Loading…
Reference in New Issue
Block a user