Release to master

This commit is contained in:
Daniel 2020-12-01 19:26:17 +01:00
commit 781e45502a
4 changed files with 28 additions and 6 deletions

View file

@ -32,8 +32,18 @@ func init() {
// NewBBolt opens/creates a bbolt database. // NewBBolt opens/creates a bbolt database.
func NewBBolt(name, location string) (storage.Interface, error) { func NewBBolt(name, location string) (storage.Interface, error) {
// Create options for bbolt database.
dbFile := filepath.Join(location, "db.bbolt")
dbOptions := &bbolt.Options{
Timeout: 1 * time.Second,
}
db, err := bbolt.Open(filepath.Join(location, "db.bbolt"), 0600, nil) // Open/Create database, retry if there is a timeout.
db, err := bbolt.Open(dbFile, 0600, dbOptions)
for i := 0; i < 5 && err != nil; i++ {
// Try again if there is an error.
db, err = bbolt.Open(dbFile, 0600, dbOptions)
}
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -173,6 +173,13 @@ func startModules() error {
case statusReady: case statusReady:
execCnt++ execCnt++
m.start(reports) m.start(reports)
// DEBUG SNIPPET
// Slow-start for non-attributable performance issues.
// If you use subsystems, you'll need the snippet there too.
// log.Errorf("modules: starting %s", m.Name)
// time.Sleep(10 * time.Second)
// break
// END DEBUG SNIPPET
} }
} }

View file

@ -187,6 +187,11 @@ func (mng *Manager) shouldServeUpdates() bool {
// CheckConfig checks subsystem configuration values and enables // CheckConfig checks subsystem configuration values and enables
// or disables subsystems and their dependencies as required. // or disables subsystems and their dependencies as required.
func (mng *Manager) CheckConfig(ctx context.Context) error { func (mng *Manager) CheckConfig(ctx context.Context) error {
// DEBUG SNIPPET
// Slow-start for non-attributable performance issues.
// You'll need the snippet in the modules too.
// time.Sleep(11 * time.Second)
// END DEBUG SNIPPET
return mng.handleConfigChanges(ctx) return mng.handleConfigChanges(ctx)
} }

View file

@ -51,11 +51,6 @@ func (reg *ResourceRegistry) ScanStorage(root string) error {
return nil return nil
} }
// ignore directories
if info.IsDir() {
return nil
}
// get relative path to storage // get relative path to storage
relativePath, err := filepath.Rel(reg.storageDir.Path, path) relativePath, err := filepath.Rel(reg.storageDir.Path, path)
if err != nil { if err != nil {
@ -72,6 +67,11 @@ func (reg *ResourceRegistry) ScanStorage(root string) error {
return nil return nil
} }
// fully ignore directories that also have an identifier - these will be unpacked resources
if info.IsDir() {
return filepath.SkipDir
}
// save // save
err = reg.AddResource(identifier, version, true, false, false) err = reg.AddResource(identifier, version, true, false, false)
if err != nil { if err != nil {