diff --git a/app/observers/project_observer.rb b/app/observers/project_observer.rb
index dda7be625daf58de29061c92e6aa65afd692f45b..bd88bb838efb5276e71ff213888287d0fa546f91 100644
--- a/app/observers/project_observer.rb
+++ b/app/observers/project_observer.rb
@@ -15,6 +15,10 @@ class ProjectObserver < BaseObserver
     project.rename_repo if project.path_changed?
   end
 
+  def before_destroy(project)
+    project.repository.expire_cache unless project.empty_repo?
+  end
+
   def after_destroy(project)
     GitlabShellWorker.perform_async(
       :remove_repository,