- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/internals/counter/processor/userprocessor.php
- Класс: BitrixTasksInternalsCounterProcessorUserProcessor
- Вызов: UserProcessor::recount
public function recount(string $counter, array $taskIds = []): void
{
if (!in_array($counter, [CounterDictionary::COUNTER_EXPIRED, CounterDictionary::COUNTER_NEW_COMMENTS]))
{
throw new UnknownCounterException();
}
$targetTasks = $taskIds;
if (empty($targetTasks))
{
$targetTasks = $this->getUserTasks();
}
if (count($targetTasks) > CounterController::STEP_LIMIT)
{
$chunks = array_chunk($targetTasks, CounterController::STEP_LIMIT);
/**
* the first one will be return for immediately counting
*/
$targetTasks = array_shift($chunks);
foreach ($chunks as $i => $rows)
{
$this->addToQueue($counter, $rows);
}
(new Agent())->addAgent();
}
$counters = $this->getCollector()->recount($counter, $targetTasks);
if ($counter === CounterDictionary::COUNTER_EXPIRED)
{
$counterTypes = array_merge(array_values(CounterDictionary::MAP_EXPIRED), CounterDictionary::MAP_MUTED_EXPIRED);
}
else if ($counter === CounterDictionary::COUNTER_NEW_COMMENTS)
{
$counterTypes = array_merge(array_values(CounterDictionary::MAP_COMMENTS), CounterDictionary::MAP_MUTED_COMMENTS);
}
self::reset($this->userId, $counterTypes, $taskIds);
$this->batchInsert($counters);
CounterState::getInstance($this->userId)->updateState($counters, $counterTypes, $taskIds);
}