mtredisalze: made quantification a constant (default 1). Increase value if the _really_ produces too much data.

This commit is contained in:
Sascha L. Teichmann 2014-09-18 11:43:12 +02:00
parent 617a3081b2
commit 02593a22d1

View File

@ -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 {