← All changes
|
includes/Admin/Product/Services/ProductSyncService.php
+18
-4
1.10.13
→
1.10.22
View file →
| @@ -103,12 +103,26 @@ | ||
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function enqueueAutoConnect($cursor = null): void | |
| 108 | - { | |
| 109 | - $payload['cursor'] = $cursor; | |
| 110 | - $data = $this->jobManager->createJob( | |
| 107 | + public function enqueueAutoConnect($cursor = null): void | |
| 108 | + { | |
| 109 | + $pendingJob = $this->jobManager->getJob([ | |
| 110 | + 'job_type' => self::JOB_TYPE_AUTO_CONNECT, | |
| 111 | + 'status' => 'pending', | |
| 112 | + ]); | |
| 113 | + $processingJob = $this->jobManager->getJob([ | |
| 114 | + 'job_type' => self::JOB_TYPE_AUTO_CONNECT, | |
| 115 | + 'status' => 'processing', | |
| 116 | + ]); | |
| 117 | + | |
| 118 | + if ($pendingJob || $processingJob) return; | |
| 119 | + | |
| 120 | + $payload = ['mode' => 'vendor']; | |
| 121 | + if ($cursor !== null) { | |
| 122 | + $payload['cursor'] = $cursor; | |
| 123 | + } | |
| 124 | + $data = $this->jobManager->createJob( | |
| 111 | 125 | self::JOB_TYPE_AUTO_CONNECT, |
| 112 | 126 | 'pending', |
| 113 | 127 | json_encode($payload) |
| 114 | 128 | ); |