Skip to content

Commit

Permalink
Merge pull request #45 from bilibili/fix_no_abort
Browse files Browse the repository at this point in the history
fix init project abort
  • Loading branch information
felixhao committed Aug 23, 2019
2 parents f112a9e + 2646290 commit 0621a82
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
cmd/discovery/discovery
dist/
configs/
go.sum
26 changes: 15 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
#### Discovery

##### Version 1.1.1
1. fix initproject abort

##### Version 1.1.0
> 1. use kratos pkg
> 2. replace gin by kratos/bm
> 3. fix poll return nil when be canceled.
> 4. add init protect mode
> 5. supoort set.
1. use kratos pkg
2. replace gin by kratos/bm
3. fix poll return nil when be canceled.
4. add init protect mode
5. supoort set.

##### Version 1.0.2
> 1.fix nodesproc. get all zone nodes.
1.fix nodesproc. get all zone nodes.

##### Version 1.0.1
> 1.rename import path
1.rename import path

##### Version 1.0.0
> 1. discovery register&polls&replica
> 2. self-discovering nodes
> 3. metadata updates
> 4. naming client & grpc resolver
1. discovery register&polls&replica
2. self-discovering nodes
3. metadata updates
4. naming client & grpc resolver
7 changes: 3 additions & 4 deletions http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
var (
dis *discovery.Discovery
protected = true
errProtected = errors.New("discovery in protect mode,only support register")
errProtected = errors.New("discovery in protect mode and only support register")
)

// Init init http
Expand Down Expand Up @@ -47,8 +47,7 @@ func innerRouter(e *bm.Engine) {

func initProtect(ctx *bm.Context) {
if dis.Protected() {
ctx.JSONMap(map[string]interface{}{
"message": errProtected.Error(),
}, errProtected)
ctx.JSON(nil, errProtected)
ctx.AbortWithStatus(503)
}
}

0 comments on commit 0621a82

Please sign in to comment.