• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/posting/segmentdatabuilder.php
  • Класс: BitrixSenderPostingSegmentDataBuilder
  • Вызов: SegmentDataBuilder::calculateCurrentFilterCount
public function calculateCurrentFilterCount()
{
	$groupState = $this->getCurrentGroupState();

	if (!$groupState)
	{
		return new ConnectorDataCounter([]);
	}

	$connector = ConnectorManager::getConnector(
		json_decode($groupState['ENDPOINT'], true)
	);

	if (!$connector)
	{
		$this->clearBuilding($groupState['ID']);
		return new ConnectorDataCounter([]);
	}

	$counter = new ConnectorDataCounter(QueryCount::getPreparedCount(
		$this->getQuery(),
		self::SEGMENT_TABLE,
		self::CONNECTOR_ENTITY[$connector->getCode()]
	));

	Segment::updateAddressCounters($this->groupId, [$counter]);
	if (CModule::IncludeModule('pull'))
	{
		CPullWatch::AddToStack(
			self::FILTER_COUNTER_TAG,
			[
				'module_id' => 'sender',
				'command' => 'updateFilterCounter',
				'params' => [
					'groupId' => $this->groupId,
					'filterId' => $this->filterId,
					'count' => $counter->getArray(),
					'state' => $groupState['STATE'],
					'completed' => (int)$groupState['STATE'] === GroupStateTable::STATES['COMPLETED']
				],
			]
		);
	}

	return $counter;
}