Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "cmd",
embed = [":go_default_library"],
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
data = ["passport-user-compare-job.toml"],
importpath = "go-common/app/job/main/passport-user-compare/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/job/main/passport-user-compare/conf:go_default_library",
"//app/job/main/passport-user-compare/http:go_default_library",
"//library/log:go_default_library",
"//library/net/trace:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,43 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/job/main/passport-user-compare/conf"
"go-common/app/job/main/passport-user-compare/http"
"go-common/library/log"
"go-common/library/net/trace"
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
log.Error("conf.Init() error(%v)", err)
panic(err)
}
log.Init(conf.Conf.Log)
defer log.Close()
// init trace
trace.Init(conf.Conf.Tracer)
defer trace.Close()
// service init
http.Init(conf.Conf)
// init signal
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
log.Info("passport-user-compare get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
log.Info("passport-user-compare exit")
return
case syscall.SIGHUP:
default:
return
}
}
}

View File

@@ -0,0 +1,85 @@
[log]
dir = "/Users/allen/data/log/passport-user-compare"
dataFixSwitch = true
incrDataFixSwitch = true
[fullTask]
switch = true
step = 1000
accountEnd = 400002500
accountInfoEnd = 25053
accountSnsEnd = 25053
cronFullStr = "0 35 17 * * *"
[incTask]
switch = false
startTime = "2018-09-28 16:40:00"
stepDuration = "10m"
cronIncStr = "0 */10 * * * *"
[duplicateTask]
switch = false
duplicateCron = "*/30 * * * * ?"
[weChat]
token = "GYQeuDWBbAsCNeGz"
secret = "ZKpmgINTkianyMbMixyxcPQjMCSHCDrk"
username = "wutao"
[httpClient]
dial = "10s"
timeout = "10s"
keepAlive = "60s"
key = "4699a07e59d7149e"
secret = "test"
[httpClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[db.origin]
addr = "172.16.33.205:3306"
dsn = "aso:hA0DAnENNFz78kYB@tcp(172.16.33.205:3306)/aso?timeout=1s&readTimeout=1s&writeTimeout=1s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 2
queryTimeout = "10s"
execTimeout = "20s"
tranTimeout = "20s"
[db.origin.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[db.user]
addr = "127.0.0.1:3306"
dsn = "root:123456@tcp(127.0.0.1:3306)/test?timeout=1s&readTimeout=1s&writeTimeout=1s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 2
queryTimeout = "10s"
execTimeout = "20s"
tranTimeout = "20s"
[db.user.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[db.secret]
addr = "127.0.0.1:3306"
dsn = "root:123456@tcp(127.0.0.1:3306)/test?timeout=1s&readTimeout=1s&writeTimeout=1s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 2
queryTimeout = "10s"
execTimeout = "20s"
tranTimeout = "20s"
[db.secret.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100