mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 09:10:17 +01:00
mtredisalze: made quantification a constant (default 1). Increase value if the _really_ produces too much data.
This commit is contained in:
parent
617a3081b2
commit
02593a22d1
@ -11,6 +11,9 @@ import (
|
|||||||
"bitbucket.org/s_l_teichmann/mtredisalize/common"
|
"bitbucket.org/s_l_teichmann/mtredisalize/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Pull up if it _really_ produces too much data.
|
||||||
|
const quantizationFactor = 1
|
||||||
|
|
||||||
type quantizedXZ struct {
|
type quantizedXZ struct {
|
||||||
X, Z int16
|
X, Z int16
|
||||||
}
|
}
|
||||||
@ -32,12 +35,13 @@ func (ct *ChangeTracker) BlockChanged(key []byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
ct.mutex.Lock()
|
ct.mutex.Lock()
|
||||||
ct.changes[quantizedXZ{X: coord.X / 16, Z: coord.Z / 16}] = true
|
ct.changes[quantizedXZ{
|
||||||
|
X: coord.X / quantizationFactor,
|
||||||
|
Z: coord.Z / quantizationFactor}] = true
|
||||||
ct.mutex.Unlock()
|
ct.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ct *ChangeTracker) FlushChanges(url string) (err error) {
|
func (ct *ChangeTracker) FlushChanges(url string) (err error) {
|
||||||
log.Println("change flush triggered")
|
|
||||||
var oldChanges map[quantizedXZ]bool
|
var oldChanges map[quantizedXZ]bool
|
||||||
ct.mutex.Lock()
|
ct.mutex.Lock()
|
||||||
if len(ct.changes) > 0 {
|
if len(ct.changes) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user