-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
123 changed files
with
464 additions
and
1,436 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,40 @@ | ||
package main | ||
|
||
import ( | ||
"comment-job/bootstrap" | ||
"comment-job/httpserver" | ||
"comment-job/libary/conf" | ||
"comment-job/model/dao/cache/redis" | ||
"context" | ||
|
||
"github.com/longpi1/gopkg/libary/log" | ||
"github.com/longpi1/gopkg/libary/queue" | ||
"github.com/longpi1/gopkg/libary/utils" | ||
) | ||
|
||
func main() { | ||
config := conf.GetConfig() | ||
log.NewLogger(config.AppConfig.Debug, config.AppConfig.LogFilePath) | ||
|
||
err := bootstrap.Boostrap(config) | ||
if err != nil { | ||
log.Fatal("boostrap fail", err) | ||
} | ||
// 启动http服务路由 | ||
httpserver.SetRouter(config.AppConfig.Port) | ||
|
||
// 启动队列进行消费 | ||
queue.StartConsumersListener(context.Background()) | ||
|
||
// 优雅关闭 | ||
utils.NewHook().Close( | ||
// 关闭 cache | ||
func() { | ||
if redis.GetClient() != nil { | ||
if err := redis.GetClient().Close(); err != nil { | ||
log.Error("redis cache close err", err) | ||
} | ||
} | ||
}, | ||
) | ||
} |
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.