Fast path bundle cleanup on load

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2018-07-25 14:37:56 -04:00
parent 26e2dd6754
commit 710df57854

View File

@ -174,6 +174,15 @@ func (m *TaskManager) loadTasks(ctx context.Context) error {
if err != nil {
return err
}
// fast path
bf, err := ioutil.ReadDir(bundle.Path)
if err != nil {
return err
}
if len(bf) == 0 {
bundle.Delete()
continue
}
shim, err := loadShim(ctx, bundle, m.events, m.tasks)
if err != nil {
log.G(ctx).WithError(err).Errorf("cleanup dead shim %s", id)