Метод consumeFailedAttempts

private

Сигнатура метода

private function consumeFailedAttempts(int $storedAttempts): bool

Возвращает: bool

Описание

Drops the counter of the ladder if it still holds the value the decision of this cycle was made on, and reports whether it did. A counter that holds anything else belongs to another period of the feature, and the decision carried into this branch is about a period that is over. The check is a conditional delete rather than a re-read on purpose: Option::get() is served from the snapshot of the options of the module the process loaded when the hit started, so a re-read here returns the very value the decision was made on, no matter what the database holds - and Option::getRealValue() reads the same snapshot. A conditional delete asks the database itself, and it decides and consumes in one statement, so nothing can change in between. The write goes around Option because it has no compare-and-swap. Option::delete() is called right after it for the caches only: the value has to disappear from the snapshot of this process and from the managed cache of the module, and that is what the following read of the state of the feature relies on.

Параметры

1
Имя Тип По умолчанию Флаги
$storedAttempts int —
—

Расположение

Исходный файл метода в Bitrix Framework

Путь к исходному файлу Source
~/bitrix/modulescrm/lib/agent/copilot/callscoringv2bootstrapagent.php
Расположение метода в файле
Строки 368–394

Исходный код

PHP