PushMessage's {{servedVariants < totalVariants}} even though all variants have {{serverBatches == totalBatches}}.
This is caused by the counting logic here: https://github.com/aerogear/aerogear-unifiedpush-server/blob/1.1.0-beta.4/push/sender/src/main/java/org/jboss/aerogear/unifiedpush/message/MetricsCollector.java#L96-L107
and can be reproduced with a modified test here: https://gist.github.com/lfryc/12638f604fe567475a67#file-testmetricscollector-java-L129-L172
Notice that collectMetrics is invoked before sending events:
{code} metricsCollector.collectMetrics(variant1Metric1); metricsCollector.collectMetrics(variant1Metric2); metricsCollector.collectMetrics(variant2Metric1);
send(batchLoadedQueue, new BatchLoadedEvent(variantID1), variantID1); send(allBatchesLoaded, new AllBatchesLoadedEvent(variantID1), variantID1); {code}
The best resolution is described here: AGPUSH-1512
But as a temporary workaround, we could make client to do the counting for us math and recount variants that have {{servedBatches == totalBatches}} as well as number of {{receivers}}.
|