mirror of
https://github.com/safing/portbase
synced 2025-09-02 10:40:39 +00:00
Release to master
This commit is contained in:
commit
781e45502a
4 changed files with 28 additions and 6 deletions
|
@ -32,8 +32,18 @@ func init() {
|
|||
|
||||
// NewBBolt opens/creates a bbolt database.
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -173,6 +173,13 @@ func startModules() error {
|
|||
case statusReady:
|
||||
execCnt++
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,11 @@ func (mng *Manager) shouldServeUpdates() bool {
|
|||
// CheckConfig checks subsystem configuration values and enables
|
||||
// or disables subsystems and their dependencies as required.
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -51,11 +51,6 @@ func (reg *ResourceRegistry) ScanStorage(root string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ignore directories
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
// get relative path to storage
|
||||
relativePath, err := filepath.Rel(reg.storageDir.Path, path)
|
||||
if err != nil {
|
||||
|
@ -72,6 +67,11 @@ func (reg *ResourceRegistry) ScanStorage(root string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// fully ignore directories that also have an identifier - these will be unpacked resources
|
||||
if info.IsDir() {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
|
||||
// save
|
||||
err = reg.AddResource(identifier, version, true, false, false)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue