protected function pingAgent($interval, array $callChain)
    {
        if (!$this->isAgentMode()) {
            return;
        }

        $name = $this->getAgentName($callChain);
        $model = new \CAgent();

        $rsAgent = $model->GetList([], ['NAME' => $name]);

        if ($agent = $rsAgent->Fetch()) {
            $dateCheck = DateTime::createFromTimestamp(time() + $interval * 60);

            $pingResult = $model->Update($agent['ID'], ['DATE_CHECK' => $dateCheck->toString()]);

            if (!$pingResult) {
                // @todo warning
            }
        } else {
            // @todo warning
        }
    }
protected function pingAgent($interval, array $callChain)
    {
        if (!$this->isAgentMode()) {
            return;
        }

        $name = $this->getAgentName($callChain);
        $model = new \CAgent();

        $rsAgent = $model->GetList([], ['NAME' => $name]);

        if ($agent = $rsAgent->Fetch()) {
            $dateCheck = DateTime::createFromTimestamp(time() + $interval * 60);

            $pingResult = $model->Update($agent['ID'], ['DATE_CHECK' => $dateCheck->toString()]);

            if (!$pingResult) {
                // @todo warning
            }
        } else {
            // @todo warning
        }
    }
protected function pingAgent ( $ interval , array $ callChain ) { if ( ! $ this -> isAgentMode ( ) ) { return ; } $ name = $ this -> getAgentName ( $ callChain ) ; $ model = new \ CAgent ( ) ; $ rsAgent = $ model -> GetList ( [ ] , [ 'NAME' => $ name ] ) ; if ( $ agent = $ rsAgent -> Fetch ( ) ) { $ dateCheck = DateTime :: createFromTimestamp ( time ( ) + $ interval * 60 ) ; $ pingResult = $ model -> Update ( $ agent [ 'ID' ] , [ 'DATE_CHECK' => $ dateCheck -> toString ( ) ] ) ; if ( ! $ pingResult ) { // @todo warning } } else { // @todo warning } }
Ping from the agent to inform that it still works correctly. Use this method if your agent
works more 10 minutes, otherwise Bitrix will be consider your agent as non-working.

Usage:
```php
public function executeAgent($param1, $param2)
{
// start a heavy (big) cycle

$this->pingAgent(20, ['executeAgent' => [$param1, $param2]]);

// end of cycle
}
```

@param int $interval The time in minutes after which the agent will be considered non-working.
@param array $callChain Array with the call any methods from Agent class.
Ping from the agent to inform that it still works correctly . Use this method if your agent works more 10 minutes otherwise Bitrix will be consider your agent as non - working .