| | |
| | | // Use provided operation_id or generate one |
| | | $op->id = !empty($options['operation_id']) |
| | | ? $options['operation_id'] |
| | | : 'u' . $userId . '_' . uniqid('op_'); |
| | | : self::generateID($userId); |
| | | |
| | | $op->type = $type; |
| | | $op->userId = $userId; |
| | |
| | | |
| | | private function runQueueOnShutdown(): void |
| | | { |
| | | if (!has_action('shutdown', [$this, 'processQueueOnShutdown'])) { |
| | | if (!has_action('shutdown', [$this, 'processQueueOnShutdown']) && $this->processor->hasAdequateResources()) { |
| | | add_action('shutdown', [$this, 'processQueueOnShutdown'], 100); |
| | | } |
| | | } |
| | |
| | | return $response; |
| | | } |
| | | } |
| | | |
| | | public static function generateId(int $userID):string |
| | | { |
| | | return 'u' . $userID . '_' . uniqid('op_'); |
| | | } |
| | | } |