Changeset 3789172 for subtleforms/trunk/src/Async/AsyncDispatcher.php
- Timestamp:
- 11/07/2026 08:16:35 AM (10 hours ago)
- File:
-
- 1 edited
-
subtleforms/trunk/src/Async/AsyncDispatcher.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
subtleforms/trunk/src/Async/AsyncDispatcher.php
r3782922 r3789172 145 145 146 146 return true; 147 } 148 149 /** 150 * Queue an email marketing job for an entry and one service. 151 * 152 * The job carries the entry ID, never the answers: they are read back 153 * from the entry when the job runs. 154 * 155 * @param array $job { service, submission_id, form_id, retry_count, feeds }. 156 * @param int $delay Seconds until it runs. 157 * @return bool True if the job was scheduled. 158 */ 159 public static function dispatchEmailMarketing( array $job, int $delay = 0 ): bool { 160 if ( empty( $job['submission_id'] ) || empty( $job['service'] ) ) { 161 self::log( 'Email marketing dispatch failed: missing entry or service' ); 162 return false; 163 } 164 $job['dispatch_id'] = self::dispatchId(); 165 $scheduled = wp_schedule_single_event( time() + max( 0, $delay ), 'subtleforms_async_email_marketing', array( $job ) ); 166 if ( false === $scheduled ) { 167 self::log( 'Failed to schedule email marketing job', array( 'submission_id' => $job['submission_id'], 'service' => $job['service'] ) ); 168 return false; 169 } 170 return true; 171 } 172 173 /** 174 * Execute an email marketing job (called by WP Cron). 175 * 176 * @param array $job Job from dispatchEmailMarketing(). 177 * @return void 178 */ 179 public static function executeEmailMarketing( array $job ): void { 180 \SubtleForms\Integrations\EmailMarketing\Sender::run( $job ); 147 181 } 148 182
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)