mirror of https://github.com/tidwall/tile38.git
Removed unused atomics
This commit is contained in:
parent
58421ef806
commit
37531f9350
|
@ -169,6 +169,7 @@ func (server *Server) writeAOF(args []string, d *commandDetailsT) error {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// live geofences
|
||||
server.lcond.L.Lock()
|
||||
if d.parent {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
type aint struct{ v uintptr }
|
||||
|
@ -32,41 +30,3 @@ func (a *abool) set(t bool) bool {
|
|||
}
|
||||
return atomic.SwapUint32(&a.v, 0) != 0
|
||||
}
|
||||
|
||||
type astring struct {
|
||||
mu sync.Mutex
|
||||
v string
|
||||
}
|
||||
|
||||
func (a *astring) get() string {
|
||||
a.mu.Lock()
|
||||
p := a.v
|
||||
a.mu.Unlock()
|
||||
return p
|
||||
}
|
||||
func (a *astring) set(s string) string {
|
||||
a.mu.Lock()
|
||||
p := a.v
|
||||
a.v = s
|
||||
a.mu.Unlock()
|
||||
return p
|
||||
}
|
||||
|
||||
type atime struct {
|
||||
mu sync.Mutex
|
||||
v time.Time
|
||||
}
|
||||
|
||||
func (a *atime) get() time.Time {
|
||||
a.mu.Lock()
|
||||
p := a.v
|
||||
a.mu.Unlock()
|
||||
return p
|
||||
}
|
||||
func (a *atime) set(t time.Time) time.Time {
|
||||
a.mu.Lock()
|
||||
p := a.v
|
||||
a.v = t
|
||||
a.mu.Unlock()
|
||||
return p
|
||||
}
|
||||
|
|
|
@ -80,7 +80,6 @@ type Server struct {
|
|||
statsTotalCommands aint // counter for total commands
|
||||
statsExpired aint // item expiration counter
|
||||
lastShrinkDuration aint
|
||||
currentShrinkStart atime
|
||||
stopBackgroundExpiring abool
|
||||
stopWatchingMemory abool
|
||||
stopWatchingAutoGC abool
|
||||
|
|
|
@ -160,7 +160,8 @@ func (c *Server) writeInfoPersistence(w *bytes.Buffer) {
|
|||
fmt.Fprintf(w, "aof_enabled:1\r\n")
|
||||
fmt.Fprintf(w, "aof_rewrite_in_progress:%d\r\n", boolInt(c.shrinking)) // Flag indicating a AOF rewrite operation is on-going
|
||||
fmt.Fprintf(w, "aof_last_rewrite_time_sec:%d\r\n", c.lastShrinkDuration.get()/int(time.Second)) // Duration of the last AOF rewrite operation in seconds
|
||||
currentShrinkStart := c.currentShrinkStart.get()
|
||||
|
||||
var currentShrinkStart time.Time // c.currentShrinkStart.get()
|
||||
if currentShrinkStart.IsZero() {
|
||||
fmt.Fprintf(w, "aof_current_rewrite_time_sec:0\r\n") // Duration of the on-going AOF rewrite operation if any
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue