Skip to content

Commit 85ed5e4

Browse files
committed
fix(server): sync commitSizeLimit default with CollectionSession.trlimit
application.py unconditionally overwrote session.trlimit with the config value, which defaulted to 0 (no limit), silently negating the trlimit=5000 class default added in 89be20c. Reference CollectionSession.trlimit directly so the default cannot silently drift if the class default ever changes, and add a regression test.
1 parent 6b372e7 commit 85ed5e4

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

server/demo.conf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@
4848
# Doesn't effect IOC clients
4949
#commitInterval = 5.0
5050

51-
# Maximum size before committing updates
52-
# The default is 0 (which is no limit)
53-
#commitSizeLimit = 0
51+
# Maximum records per commit. Default is 5000; set to 0 for no limit.
52+
#commitSizeLimit = 5000
5453

5554
# Maximum concurrent "active" clients
5655
# to allow.

server/recceiver/application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from . import metrics
1616
from .announcer import Announcer, SharedUDP
1717
from .processors import ProcessorController
18-
from .recast import CastFactory
18+
from .recast import CastFactory, CollectionSession
1919

2020
log = logging.getLogger(__name__)
2121

@@ -46,7 +46,7 @@ def __init__(self, config):
4646
self.annperiod = float(config.get("announceInterval", "15.0"))
4747
self.tcptimeout = float(config.get("tcptimeout", "15.0"))
4848
self.commitperiod = float(config.get("commitInterval", "5.0"))
49-
self.commitSizeLimit = int(config.get("commitSizeLimit", "0"))
49+
self.commitSizeLimit = int(config.get("commitSizeLimit", str(CollectionSession.trlimit)))
5050
self.maxActive = int(config.get("maxActive", "20"))
5151
self.bind, _sep, portn = config.get("bind", "").strip().partition(":")
5252
self.addrlist = []
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from recceiver.application import RecService
2+
from recceiver.recast import CollectionSession
3+
4+
5+
class TestRecServiceConfig:
6+
def test_commit_size_limit_defaults_to_class_default(self):
7+
svc = RecService({})
8+
assert svc.commitSizeLimit == CollectionSession.trlimit
9+
10+
def test_commit_size_limit_reads_from_config(self):
11+
svc = RecService({"commitSizeLimit": "100"})
12+
assert svc.commitSizeLimit == 100
13+
14+
def test_commit_size_limit_zero_disables_splitting(self):
15+
svc = RecService({"commitSizeLimit": "0"})
16+
assert svc.commitSizeLimit == 0

0 commit comments

Comments
 (0)