Merge remote-tracking branch 'origin/sh-flush-cache-after-import'
This commit is contained in:
		
						commit
						1a7ba2a5e8
					
				| 
						 | 
					@ -14,6 +14,7 @@ Please view this file on the master branch, on stable branches it's out of date.
 | 
				
			||||||
## 8.13.1 (unreleased)
 | 
					## 8.13.1 (unreleased)
 | 
				
			||||||
  - Fix error in generating labels
 | 
					  - Fix error in generating labels
 | 
				
			||||||
  - Fix reply-by-email not working due to queue name mismatch
 | 
					  - Fix reply-by-email not working due to queue name mismatch
 | 
				
			||||||
 | 
					  - Expire and build repository cache after project import
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 8.13.0 (2016-10-22)
 | 
					## 8.13.0 (2016-10-22)
 | 
				
			||||||
  - Removes extra line for empty issue description. (!7045)
 | 
					  - Removes extra line for empty issue description. (!7045)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -419,6 +419,17 @@ class Repository
 | 
				
			||||||
    @exists = nil
 | 
					    @exists = nil
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # expire cache that doesn't depend on repository data (when expiring)
 | 
				
			||||||
 | 
					  def expire_content_cache
 | 
				
			||||||
 | 
					    expire_tags_cache
 | 
				
			||||||
 | 
					    expire_tag_count_cache
 | 
				
			||||||
 | 
					    expire_branches_cache
 | 
				
			||||||
 | 
					    expire_branch_count_cache
 | 
				
			||||||
 | 
					    expire_root_ref_cache
 | 
				
			||||||
 | 
					    expire_emptiness_caches
 | 
				
			||||||
 | 
					    expire_exists_cache
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Runs code after a repository has been created.
 | 
					  # Runs code after a repository has been created.
 | 
				
			||||||
  def after_create
 | 
					  def after_create
 | 
				
			||||||
    expire_exists_cache
 | 
					    expire_exists_cache
 | 
				
			||||||
| 
						 | 
					@ -434,14 +445,7 @@ class Repository
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    expire_cache if exists?
 | 
					    expire_cache if exists?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # expire cache that don't depend on repository data (when expiring)
 | 
					    expire_content_cache
 | 
				
			||||||
    expire_tags_cache
 | 
					 | 
				
			||||||
    expire_tag_count_cache
 | 
					 | 
				
			||||||
    expire_branches_cache
 | 
					 | 
				
			||||||
    expire_branch_count_cache
 | 
					 | 
				
			||||||
    expire_root_ref_cache
 | 
					 | 
				
			||||||
    expire_emptiness_caches
 | 
					 | 
				
			||||||
    expire_exists_cache
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    repository_event(:remove_repository)
 | 
					    repository_event(:remove_repository)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					@ -473,14 +477,13 @@ class Repository
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def before_import
 | 
					  def before_import
 | 
				
			||||||
    expire_emptiness_caches
 | 
					    expire_content_cache
 | 
				
			||||||
    expire_exists_cache
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Runs code after a repository has been forked/imported.
 | 
					  # Runs code after a repository has been forked/imported.
 | 
				
			||||||
  def after_import
 | 
					  def after_import
 | 
				
			||||||
    expire_emptiness_caches
 | 
					    expire_content_cache
 | 
				
			||||||
    expire_exists_cache
 | 
					    build_cache
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Runs code after a new commit has been pushed.
 | 
					  # Runs code after a new commit has been pushed.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1146,28 +1146,17 @@ describe Repository, models: true do
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe '#before_import' do
 | 
					  describe '#before_import' do
 | 
				
			||||||
    it 'flushes the emptiness cachess' do
 | 
					    it 'flushes the repository caches' do
 | 
				
			||||||
      expect(repository).to receive(:expire_emptiness_caches)
 | 
					      expect(repository).to receive(:expire_content_cache)
 | 
				
			||||||
 | 
					 | 
				
			||||||
      repository.before_import
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it 'flushes the exists cache' do
 | 
					 | 
				
			||||||
      expect(repository).to receive(:expire_exists_cache)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      repository.before_import
 | 
					      repository.before_import
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe '#after_import' do
 | 
					  describe '#after_import' do
 | 
				
			||||||
    it 'flushes the emptiness cachess' do
 | 
					    it 'flushes and builds the cache' do
 | 
				
			||||||
      expect(repository).to receive(:expire_emptiness_caches)
 | 
					      expect(repository).to receive(:expire_content_cache)
 | 
				
			||||||
 | 
					      expect(repository).to receive(:build_cache)
 | 
				
			||||||
      repository.after_import
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it 'flushes the exists cache' do
 | 
					 | 
				
			||||||
      expect(repository).to receive(:expire_exists_cache)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      repository.after_import
 | 
					      repository.after_import
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue