Merge pull request #2499 from crosbymichael/fast

Fast path bundle cleanup on load
This commit is contained in:
Derek McGowan 2018-07-25 16:31:39 -07:00 committed by GitHub
commit d02728ff4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)