Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow startup duration/interval to be overridden via environement vars #426

Merged
merged 3 commits into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions appsdk/configupdates.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/edgexfoundry/go-mod-bootstrap/bootstrap/config"
"github.com/edgexfoundry/go-mod-bootstrap/bootstrap/startup"

"github.com/edgexfoundry/app-functions-sdk-go/internal"
"github.com/edgexfoundry/app-functions-sdk-go/internal/bootstrap/handlers"
)

Expand Down Expand Up @@ -137,7 +136,7 @@ func (processor *ConfigUpdateProcessor) processConfigChangedStoreForwardEnabled(
// StoreClient must be set up for StoreAndForward
if sdk.storeClient == nil {
var err error
startupTimer := startup.NewStartUpTimer(internal.BootRetrySecondsDefault, internal.BootTimeoutSecondsDefault)
startupTimer := startup.NewStartUpTimer(sdk.ServiceKey)
sdk.storeClient, err = handlers.InitializeStoreClient(sdk.secretProvider, sdk.config, startupTimer, sdk.LoggingClient)
if err != nil {
// Error already logged
Expand Down
2 changes: 1 addition & 1 deletion appsdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (sdk *AppFunctionsSDK) GetAppSettingStrings(setting string) ([]string, erro
// Initialize will parse command line flags, register for interrupts,
// initialize the logging system, and ingest configuration.
func (sdk *AppFunctionsSDK) Initialize() error {
startupTimer := startup.NewStartUpTimer(internal.BootRetrySecondsDefault, internal.BootTimeoutSecondsDefault)
startupTimer := startup.NewStartUpTimer(sdk.ServiceKey)

additionalUsage :=
" -s/--skipVersionCheck Indicates the service should skip the Core Service's version compatibility check.\n" +
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690
github.com/diegoholiveira/jsonlogic v1.0.1-0.20200220175622-ab7989be08b9
github.com/eclipse/paho.mqtt.golang v1.2.0
github.com/edgexfoundry/go-mod-bootstrap v0.0.35
github.com/edgexfoundry/go-mod-bootstrap v0.0.37
github.com/edgexfoundry/go-mod-core-contracts v0.1.65
github.com/edgexfoundry/go-mod-messaging v0.1.19
github.com/edgexfoundry/go-mod-registry v0.1.20
Expand Down
3 changes: 1 addition & 2 deletions internal/bootstrap/handlers/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/edgexfoundry/go-mod-bootstrap/config"
"github.com/edgexfoundry/go-mod-bootstrap/di"

"github.com/edgexfoundry/app-functions-sdk-go/internal"
"github.com/edgexfoundry/app-functions-sdk-go/internal/bootstrap/container"
"github.com/edgexfoundry/app-functions-sdk-go/internal/common"
)
Expand Down Expand Up @@ -70,7 +69,7 @@ func TestClientsBootstrapHandler(t *testing.T) {
Protocol: "http",
}

startupTimer := startup.NewStartUpTimer(internal.BootRetrySecondsDefault, internal.BootTimeoutSecondsDefault)
startupTimer := startup.NewStartUpTimer("unit-test")

tests := []struct {
Name string
Expand Down
3 changes: 1 addition & 2 deletions internal/bootstrap/handlers/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ import (
"github.com/edgexfoundry/go-mod-registry/registry"
"github.com/stretchr/testify/assert"

"github.com/edgexfoundry/app-functions-sdk-go/internal"
"github.com/edgexfoundry/app-functions-sdk-go/internal/bootstrap/container"
"github.com/edgexfoundry/app-functions-sdk-go/internal/common"
)

func TestValidateVersionMatch(t *testing.T) {
startupTimer := startup.NewStartUpTimer(internal.BootRetrySecondsDefault, internal.BootTimeoutSecondsDefault)
startupTimer := startup.NewStartUpTimer("unit-test")

clients := make(map[string]config.ClientInfo)
clients[common.CoreDataClientName] = config.ClientInfo{
Expand Down
8 changes: 2 additions & 6 deletions internal/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package common
import (
"time"

"github.com/edgexfoundry/go-mod-bootstrap/bootstrap/interfaces"
bootstrapConfig "github.com/edgexfoundry/go-mod-bootstrap/config"

"github.com/edgexfoundry/go-mod-core-contracts/models"
Expand Down Expand Up @@ -66,8 +65,6 @@ type ConfigurationStruct struct {
SecretStore bootstrapConfig.SecretStoreInfo
// SecretStoreExclusive
SecretStoreExclusive bootstrapConfig.SecretStoreInfo
// Startup
Startup bootstrapConfig.StartupInfo
}

// ServiceInfo is used to hold and configure various settings related to the hosting of this service
Expand Down Expand Up @@ -160,14 +157,13 @@ func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) boo
}

// GetBootstrap returns the configuration elements required by the bootstrap.
func (c *ConfigurationStruct) GetBootstrap() interfaces.BootstrapConfiguration {
return interfaces.BootstrapConfiguration{
func (c *ConfigurationStruct) GetBootstrap() bootstrapConfig.BootstrapConfiguration {
return bootstrapConfig.BootstrapConfiguration{
Clients: c.Clients,
Service: c.transformToBootstrapServiceInfo(),
Registry: c.Registry,
Logging: c.Logging,
SecretStore: c.SecretStore,
Startup: c.Startup,
}
}

Expand Down