Skip to content

Commit

Permalink
bugfix concurrence
Browse files Browse the repository at this point in the history
  • Loading branch information
flike committed Oct 28, 2018
1 parent 93f4cba commit 0c1c0f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/hack/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hack

const (
Version = "2018-10-11 20:01:18 +0800 @6f43a65"
Compile = "2018-10-12 11:48:56 +0800 by go version go1.9 darwin/amd64"
Version = "2018-10-15 16:55:32 +0800 @93f4cba"
Compile = "2018-10-28 17:52:02 +0800 by go version go1.10.2 darwin/amd64"
)
21 changes: 16 additions & 5 deletions proxy/router/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,9 @@ func makeList(start, end int) []int {
//if value is 2016, and indexs is [2015,2016,2017]
//the result is [2015,2016]
func makeLeList(value int, indexs []int) []int {
sort.Ints(indexs)
newIndexs := make([]int, len(indexs))
copy(newIndexs, indexs)
sort.Ints(newIndexs)
for k, v := range indexs {
if v == value {
return indexs[:k+1]
Expand All @@ -561,7 +563,9 @@ func makeLeList(value int, indexs []int) []int {
//if value is 2016, and indexs is [2015,2016,2017,2018]
//the result is [2016,2017,2018]
func makeGeList(value int, indexs []int) []int {
sort.Ints(indexs)
newIndexs := make([]int, len(indexs))
copy(newIndexs, indexs)
sort.Ints(newIndexs)
for k, v := range indexs {
if v == value {
return indexs[k:]
Expand All @@ -573,7 +577,9 @@ func makeGeList(value int, indexs []int) []int {
//if value is 2016, and indexs is [2015,2016,2017,2018]
//the result is [2015]
func makeLtList(value int, indexs []int) []int {
sort.Ints(indexs)
newIndexs := make([]int, len(indexs))
copy(newIndexs, indexs)
sort.Ints(newIndexs)
for k, v := range indexs {
if v == value {
return indexs[:k]
Expand All @@ -585,7 +591,9 @@ func makeLtList(value int, indexs []int) []int {
//if value is 2016, and indexs is [2015,2016,2017,2018]
//the result is [2017,2018]
func makeGtList(value int, indexs []int) []int {
sort.Ints(indexs)
newIndexs := make([]int, len(indexs))
copy(newIndexs, indexs)
sort.Ints(newIndexs)
for k, v := range indexs {
if v == value {
return indexs[k+1:]
Expand All @@ -602,7 +610,10 @@ func makeBetweenList(start, end int, indexs []int) []int {
if end < start {
start, end = end, start
}
sort.Ints(indexs)

newIndexs := make([]int, len(indexs))
copy(newIndexs, indexs)
sort.Ints(newIndexs)
for k, v := range indexs {
if v == start {
startIndex = k
Expand Down

0 comments on commit 0c1c0f2

Please sign in to comment.