Skip to content

Commit

Permalink
Fix indicator interval type
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarPetrov committed Jul 8, 2019
1 parent dad2cb9 commit b0e93e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/health/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (is *IndicatorSettings) Validate() error {
if is.FailuresTreshold <= 0 {
return fmt.Errorf("validate Settings: FailuresTreshold must be > 0")
}
if is.Interval < 30 {
if is.Interval < 30*time.Second {
return fmt.Errorf("validate Settings: Minimum interval is 30 seconds")
}
return nil
Expand Down
13 changes: 2 additions & 11 deletions pkg/sm/sm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ import (
"fmt"
h "github.com/InVisionApp/go-health"
l "github.com/InVisionApp/go-logger/shims/logrus"
"github.com/Peripli/service-manager/api/osb"
"github.com/Peripli/service-manager/pkg/health"
"net/http"
"sync"
"time"

"github.com/Peripli/service-manager/api/osb"

"github.com/Peripli/service-manager/storage/catalog"

Expand Down Expand Up @@ -152,11 +150,6 @@ func New(ctx context.Context, cancel context.CancelFunc, cfg *config.Settings) (
cfg: cfg,
}

err = smb.installHealth(cfg.Health)
if err != nil {
return nil, fmt.Errorf("error adding health chech to sm: %s", err)
}

// Register default interceptors that represent the core SM business logic
smb.
WithCreateInterceptorProvider(types.ServiceBrokerType, &interceptors.BrokerCreateCatalogInterceptorProvider{
Expand Down Expand Up @@ -187,8 +180,6 @@ func (smb *ServiceManagerBuilder) Build() *ServiceManager {
}

// setup server and add relevant global middleware
smb.installHealth()

srv := server.New(smb.cfg.Server, smb.API)
srv.Use(filters.NewRecoveryMiddleware())

Expand Down Expand Up @@ -218,7 +209,7 @@ func (smb *ServiceManagerBuilder) installHealth() error {
if err := healthz.AddCheck(&h.Config{
Name: indicator.Name(),
Checker: indicator,
Interval: indicator.Interval() * time.Second,
Interval: indicator.Interval(),
Fatal: indicator.Fatal(),
}); err != nil {
return err
Expand Down

0 comments on commit b0e93e9

Please sign in to comment.