fix(task): race condition in creating and finding meta data fixed (#828)

pull/10616/head
Lyon Hill 2018-09-13 09:11:25 -06:00 committed by GitHub
parent d26b7aba39
commit 8cc55b3a37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -226,6 +226,9 @@ func (s *inmem) DisableTask(ctx context.Context, id platform.ID) error {
}
func (s *inmem) FindTaskMetaByID(ctx context.Context, id platform.ID) (*StoreTaskMeta, error) {
s.mu.RLock()
defer s.mu.RUnlock()
meta, ok := s.runners[id.String()]
if !ok {
return nil, errors.New("task meta not found")