invalidate repo cache on delete (#1182)

Signed-off-by: Nestor <nesterran@gmail.com>
This commit is contained in:
narg95 2019-02-26 16:12:29 +01:00 committed by Alexander Matyushentsev
parent 2f62d1b763
commit caacba907c

View file

@ -351,6 +351,12 @@ func (s *Server) Delete(ctx context.Context, q *RepoQuery) (*RepoResponse, error
if !s.enf.Enforce(ctx.Value("claims"), rbacpolicy.ResourceRepositories, rbacpolicy.ActionDelete, q.Repo) {
return nil, grpc.ErrPermissionDenied
}
// invalidate cache
if err := s.cache.SetRepoConnectionState(q.Repo, nil); err == nil {
log.Errorf("error invalidating cache: %v", err)
}
err := s.db.DeleteRepository(ctx, q.Repo)
return &RepoResponse{}, err
}