Uplift max bulk string size for redisalize server to 8MB. Big TNT explosion seem to write big blocks into the database.

This commit is contained in:
Sascha L. Teichmann 2014-10-22 19:10:06 +02:00
parent 4f49d114c6
commit 1acfd26e80

View File

@ -13,6 +13,8 @@ import (
"strconv"
)
const maxBulkStringSize = 8 * 1024 * 1024
type RedisConsumer interface {
ConsumeInteger(int64) bool
ConsumeArray(int64) bool
@ -92,7 +94,7 @@ func (rp *RedisParser) bulkString(line []byte) bool {
case i == 0:
return rp.consumer.ConsumeBulkString([]byte{})
default:
if i >= 4*1024*1024 { // 4MB should be sufficient
if i > maxBulkStringSize { // prevent denial of service.
return rp.consumer.ConsumeError(
fmt.Errorf("Bulk string too large (%d bytes).\n", i))
}