Browse Source
Merge pull request #170 from Leizhengzi/main
fix bench ci error and enable ci lint github action
topic
yedf2
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
20 additions and
12 deletions
-
.github/workflows/tests.yml
-
.golangci.yml
-
bench/main.go
-
bench/svr/http.go
|
|
|
@ -41,5 +41,8 @@ jobs: |
|
|
|
run: | |
|
|
|
go mod download |
|
|
|
|
|
|
|
- name: Run CI lint |
|
|
|
run: make lint |
|
|
|
|
|
|
|
- name: Run test cover |
|
|
|
run: sh helper/test-cover.sh |
|
|
|
run: sh helper/test-cover.sh |
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
run: |
|
|
|
deadline: 5m |
|
|
|
# skip-dirs: |
|
|
|
# - test |
|
|
|
# - examples |
|
|
|
skip-dirs: |
|
|
|
- test |
|
|
|
# - bench |
|
|
|
|
|
|
|
linter-settings: |
|
|
|
goconst: |
|
|
|
|
|
|
|
@ -21,7 +21,7 @@ usage: |
|
|
|
` |
|
|
|
|
|
|
|
func hintAndExit() { |
|
|
|
fmt.Printf(usage) |
|
|
|
fmt.Print(usage) |
|
|
|
os.Exit(0) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -65,10 +65,11 @@ func reloadData() { |
|
|
|
logger.Debugf("%d users inserted. used: %dms", total, time.Since(began).Milliseconds()) |
|
|
|
} |
|
|
|
|
|
|
|
var uidCounter int32 = 0 |
|
|
|
var mode string = "" |
|
|
|
var sqls int = 1 |
|
|
|
var uidCounter int32 |
|
|
|
var mode string |
|
|
|
var sqls = 1 |
|
|
|
|
|
|
|
// PrepareBenchDB prepares db data for bench
|
|
|
|
func PrepareBenchDB() { |
|
|
|
db := pdbGet() |
|
|
|
_, err := dtmimp.DBExec(db, "drop table if exists dtm_busi.user_account_log") |
|
|
|
@ -95,7 +96,9 @@ func StartSvr() { |
|
|
|
app := dtmutil.GetGinApp() |
|
|
|
benchAddRoute(app) |
|
|
|
logger.Debugf("bench listening at %d", benchPort) |
|
|
|
go app.Run(fmt.Sprintf(":%s", benchPort)) |
|
|
|
go func() { |
|
|
|
_ = app.Run(fmt.Sprintf(":%s", benchPort)) |
|
|
|
}() |
|
|
|
} |
|
|
|
|
|
|
|
func qsAdjustBalance(uid int, amount int, c *gin.Context) (interface{}, error) { |
|
|
|
@ -116,11 +119,13 @@ func qsAdjustBalance(uid int, amount int, c *gin.Context) (interface{}, error) { |
|
|
|
if strings.Contains(mode, "barrier") { |
|
|
|
barrier, err := dtmcli.BarrierFromQuery(c.Request.URL.Query()) |
|
|
|
logger.FatalIfError(err) |
|
|
|
barrier.Call(txGet(), f) |
|
|
|
err = barrier.Call(txGet(), f) |
|
|
|
logger.FatalIfError(err) |
|
|
|
} else { |
|
|
|
tx := txGet() |
|
|
|
f(tx) |
|
|
|
err := tx.Commit() |
|
|
|
err := f(tx) |
|
|
|
logger.FatalIfError(err) |
|
|
|
err = tx.Commit() |
|
|
|
logger.FatalIfError(err) |
|
|
|
} |
|
|
|
|
|
|
|
|