diff options
Diffstat (limited to 'models/wiki.go')
-rw-r--r-- | models/wiki.go | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/models/wiki.go b/models/wiki.go index 6809c28821..89e9fdaa39 100644 --- a/models/wiki.go +++ b/models/wiki.go @@ -21,44 +21,6 @@ import ( "github.com/gogits/gogs/modules/setting" ) -// workingPool represents a pool of working status which makes sure -// that only one instance of same task is performing at a time. -// However, different type of tasks can performing at the same time. -type workingPool struct { - lock sync.Mutex - pool map[string]*sync.Mutex - count map[string]int -} - -// CheckIn checks in a task and waits if others are running. -func (p *workingPool) CheckIn(name string) { - p.lock.Lock() - - lock, has := p.pool[name] - if !has { - lock = &sync.Mutex{} - p.pool[name] = lock - } - p.count[name]++ - - p.lock.Unlock() - lock.Lock() -} - -// CheckOut checks out a task to let other tasks run. -func (p *workingPool) CheckOut(name string) { - p.lock.Lock() - defer p.lock.Unlock() - - p.pool[name].Unlock() - if p.count[name] == 1 { - delete(p.pool, name) - delete(p.count, name) - } else { - p.count[name]-- - } -} - var wikiWorkingPool = &workingPool{ pool: make(map[string]*sync.Mutex), count: make(map[string]int), @@ -117,7 +79,7 @@ func (repo *Repository) LocalWikiPath() string { // UpdateLocalWiki makes sure the local copy of repository wiki is up-to-date. func (repo *Repository) UpdateLocalWiki() error { - return updateLocalCopy(repo.WikiPath(), repo.LocalWikiPath()) + return updateLocalCopy(repo.WikiPath(), repo.LocalWikiPath(), "") } // discardLocalWikiChanges discards local commits make sure |