mirror of https://github.com/gogs/gogs.git
modules/sync: minor field refactor
parent
80cd8f6a29
commit
ad57f18894
|
@ -3,7 +3,7 @@ Gogs - Go Git Service [
|

|
||||||
|
|
||||||
##### Current tip version: 0.9.117 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
|
##### Current tip version: 0.9.118 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
|
||||||
|
|
||||||
| Web | UI | Preview |
|
| Web | UI | Preview |
|
||||||
|:-------------:|:-------:|:-------:|
|
|:-------------:|:-------:|:-------:|
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.9.117.0125"
|
const APP_VER = "0.9.118.0125"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setting.AppVer = APP_VER
|
setting.AppVer = APP_VER
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// This table is particularly useful for un/marking and checking values
|
// This table is particularly useful for un/marking and checking values
|
||||||
// in different goroutines.
|
// in different goroutines.
|
||||||
type StatusTable struct {
|
type StatusTable struct {
|
||||||
lock sync.RWMutex
|
sync.RWMutex
|
||||||
pool map[string]bool
|
pool map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,24 +26,24 @@ func NewStatusTable() *StatusTable {
|
||||||
|
|
||||||
// Start sets value of given name to true in the pool.
|
// Start sets value of given name to true in the pool.
|
||||||
func (p *StatusTable) Start(name string) {
|
func (p *StatusTable) Start(name string) {
|
||||||
p.lock.Lock()
|
p.Lock()
|
||||||
defer p.lock.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
p.pool[name] = true
|
p.pool[name] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop sets value of given name to false in the pool.
|
// Stop sets value of given name to false in the pool.
|
||||||
func (p *StatusTable) Stop(name string) {
|
func (p *StatusTable) Stop(name string) {
|
||||||
p.lock.Lock()
|
p.Lock()
|
||||||
defer p.lock.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
p.pool[name] = false
|
p.pool[name] = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsRunning checks if value of given name is set to true in the pool.
|
// IsRunning checks if value of given name is set to true in the pool.
|
||||||
func (p *StatusTable) IsRunning(name string) bool {
|
func (p *StatusTable) IsRunning(name string) bool {
|
||||||
p.lock.RLock()
|
p.RLock()
|
||||||
defer p.lock.RUnlock()
|
defer p.RUnlock()
|
||||||
|
|
||||||
return p.pool[name]
|
return p.pool[name]
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,12 +50,12 @@ func (q *UniqueQueue) AddFunc(id interface{}, fn func()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
idStr := com.ToStr(id)
|
idStr := com.ToStr(id)
|
||||||
q.table.lock.Lock()
|
q.table.Lock()
|
||||||
q.table.pool[idStr] = true
|
q.table.pool[idStr] = true
|
||||||
if fn != nil {
|
if fn != nil {
|
||||||
fn()
|
fn()
|
||||||
}
|
}
|
||||||
q.table.lock.Unlock()
|
q.table.Unlock()
|
||||||
q.queue <- idStr
|
q.queue <- idStr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.9.117.0125
|
0.9.118.0125
|
Loading…
Reference in New Issue