Fix bug about prepareBath in MetricsPersistentWorker #5399 (#5401)

* bugfix: when extend the scope and recommend to start with 10000 or scope greater than 1000   , freemarker  generate MetricsMetaInfo method will cause error such as MetricsMetaInfo("xxxx_cpm", 10,001, entityId)

Co-authored-by: jingjiu <jingjiu@tsign.cn>
Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
This commit is contained in:
gnr163 2020-08-28 11:32:24 +08:00 committed by GitHub
parent 8bf38cc29c
commit a80a55589e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -130,7 +130,7 @@ public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
* Hard coded the max size. This is only the batch size of one metrics, too large number is meaningless.
*/
int maxBatchGetSize = 2000;
final int batchSize = Math.max(maxBatchGetSize, lastCollection.size());
final int batchSize = Math.min(maxBatchGetSize, lastCollection.size());
List<Metrics> metricsList = new ArrayList<>();
for (Metrics data : lastCollection) {
transWorker.ifPresent(metricsTransWorker -> metricsTransWorker.in(data));