Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
singlethreadstrategy.php
1<?php
2
4
5use Bitrix\Main\Entity\ReferenceField;
7
9{
10 public const THREADS_COUNT = 1;
11
12 protected function setFilter():void
13 {
14 parent::setFilter();
15 $this->filter += [
16 '=POSTING_ID' => $this->postingId,
18 ];
19 }
20
21 protected function setRuntime():void
22 {
23 $this->runtime = [
24 new ReferenceField(
25 'MAILING_SUB', 'Bitrix\\Sender\\MailingSubscriptionTable', [
26 '=this.CONTACT_ID' => 'ref.CONTACT_ID',
27 '=this.POSTING.MAILING_ID' => 'ref.MAILING_ID'
28 ], ['join_type' => 'LEFT']
29 )
30 ];
31 }
32
37 protected function checkLock()
38 {
39 for($i = 0; $i <= static::THREADS_COUNT; $i++)
40 {
41 if ($this->lock())
42 {
43 return true;
44 }
45 sleep(1);
46 }
47 return false;
48 }
49}