Skip to content

Commit

Permalink
Merge pull request #155 from MindHunter86/feature/full-bypass
Browse files Browse the repository at this point in the history
feature/full-bypass
  • Loading branch information
MindHunter86 committed Mar 28, 2024
2 parents 3680410 + 6079509 commit 0a9c977
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (m *App) fbMidAppFakeQuality(ctx *fiber.Ctx) error {

// if return value == true - Balance() will be skipped
func (m *App) fbMidAppBalancerLottery(_ *fiber.Ctx) bool {
return m.runtime.Config.Get(runtime.ParamLottery).(int) < rand.Intn(99)+1 // skipcq: GSC-G404 math/rand is enough
return gCli.Bool("balancer-full-bypass") || m.runtime.Config.Get(runtime.ParamLottery).(int) < rand.Intn(99)+1 // skipcq: GSC-G404 math/rand is enough
}

func (m *App) fbMidAppBalance(ctx *fiber.Ctx) (e error) {
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func main() {
Usage: "max fails for one request; max value - 10",
Value: 3,
},
&cli.BoolFlag{
Name: "balancer-full-bypass",
Usage: "use X-Server header as a balance target",
},

// ...
&cli.DurationFlag{
Expand Down

0 comments on commit 0a9c977

Please sign in to comment.