This reverts merge request !60269 (merged) as there were some issues dealing with the case of maxEvents=-1, while @maszyman and @gemmeren work on an alternative fix.
maxEvents=-1
Tagging @amete, @nstyles, @jcatmore, @tsulaia