mirror of
https://github.com/safing/portbase
synced 2025-09-01 18:19:57 +00:00
Reset and recreate the updates tmp dir on startup
This commit is contained in:
parent
a0ec63373a
commit
98589f8008
1 changed files with 12 additions and 0 deletions
|
@ -57,6 +57,18 @@ func (reg *ResourceRegistry) Initialize(storageDir *utils.DirStructure) error {
|
|||
reg.tmpDir = storageDir.ChildDir("tmp", 0700)
|
||||
reg.resources = make(map[string]*Resource)
|
||||
|
||||
// remove tmp dir to delete old entries
|
||||
err = reg.Cleanup()
|
||||
if err != nil {
|
||||
log.Warningf("%s: failed to remove tmp dir: %s", reg.Name, err)
|
||||
}
|
||||
|
||||
// (re-)create tmp dir
|
||||
reg.tmpDir.Ensure()
|
||||
if err != nil {
|
||||
log.Warningf("%s: failed to create tmp dir: %s", reg.Name, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue