File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import (
1111 "github.com/github/freno/pkg/http"
1212 "github.com/github/freno/pkg/throttle"
1313 "github.com/outbrain/golib/log"
14+ "os"
15+ "strconv"
1416)
1517
1618// AppVersion has to be filled by ldflags:
@@ -120,6 +122,12 @@ func httpServe() error {
120122 throttler := throttle .NewThrottler ()
121123 log .Infof ("Starting consensus service" )
122124 log .Infof ("- forced leadership: %+v" , group .ForceLeadership )
125+
126+ bypassEnabled , err := strconv .ParseBool (os .Getenv ("FRENO_BYPASS_ENABLED" ))
127+ if err != nil {
128+ bypassEnabled = false
129+ }
130+ throttler .BypassOnNoHostsFound = bypassEnabled
123131 consensusServiceProvider , err := group .NewConsensusServiceProvider (throttler )
124132 if err != nil {
125133 return err
Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ type Throttler struct {
7878
7979 nonLowPriorityAppRequestsThrottled * cache.Cache
8080 httpClient * http.Client
81+
82+ BypassOnNoHostsFound bool
8183}
8284
8385func NewThrottler () * Throttler {
@@ -331,6 +333,10 @@ func (throttler *Throttler) refreshMySQLInventory() error {
331333 }
332334 }
333335 if len (totalHosts ) == 0 {
336+ if throttler .bypassOnNoHostsFound {
337+ log .Debugf ("No hosts for pool: %+v, but bypass is enabled" , poolName )
338+ return nil
339+ }
334340 return log .Errorf ("Unable to get any HAproxy hosts for pool: %+v" , poolName )
335341 }
336342
You can’t perform that action at this time.
0 commit comments