Jake Vanderwerf
2026-02-14 27fb820ae9081fb56957cf75e79eccd8a99edd52
inc/rest/routes/UploadRoutes.php
@@ -39,7 +39,7 @@
      $registry->register('image_upload', new TypeConfig(
         executor: $executor,
         chunkKey: 'secured_files',
         chunkSize: 5
         chunkSize: 3
      ));
      // Video uploads - one at a time (heavy processing)
@@ -53,7 +53,7 @@
      $registry->register('document_upload', new TypeConfig(
         executor: $executor,
         chunkKey: 'secured_files',
         chunkSize: 10
         chunkSize: 5
      ));
      // Metadata updates
@@ -110,7 +110,8 @@
         ->rateLimit(30)
         ->args([
            'user'   => 'int|required',
            'items'  => 'array|required'
            'items'  => 'array|required',
            'id'    => 'string'
         ])
         ->register();
    }
@@ -395,7 +396,9 @@
         $chunkSize = 10;
      }
      JVB()->queue()->queueOperation(
      error_log('Queueing Operation: '.print_r($operation_type, true));
      error_log('With ID: '.print_r($args['upload'], true));
      $queuedProcessing = JVB()->queue()->queueOperation(
         $operation_type,
         $args['user'],
         array_merge(
@@ -409,13 +412,15 @@
         ]
      );
      error_log('queuedProcessing operation: '.print_r($queuedProcessing, true));
      if ($args['mode'] !== 'selection') {
         $dependencies = [$args['upload']];
         if (!empty($args['depends_on'])) {
            $dependencies[] = $args['depends_on'];
         }
         JVB()->queue()->queueOperation(
         error_log('Queueing attach to upload with id: '.print_r($args['id'], true));
         error_log('And dependent on: '.print_r($dependencies, true));
         error_log('Attaching args: '.print_r($args, true));
         $attachingOp = JVB()->queue()->queueOperation(
            'attach_upload_to_content',
            $args['user'],
            $args,
@@ -425,6 +430,8 @@
               'depends_on'    => $dependencies
            ]
         );
         error_log('queued attaching operation: '.print_r($attachingOp, true));
      }
      JVB()->queue()->queueOperation(
@@ -812,7 +819,7 @@
         if (!empty($attachments)) {
            error_log('Attachments: '.print_r($attachments, true));
            return $this->queueMetaUpdate($attachments, $data['user']);
            return $this->queueMetaUpdate($attachments, absint($data['user']), sanitize_text_field($data['id']??''));
         }
@@ -882,7 +889,7 @@
   /**
    * Queue metadata update with dependency on upload operation
    */
   protected function queueMetaUpdate(array $data, int $user): WP_REST_Response
   protected function queueMetaUpdate(array $data, int $user, ?string $operationId = null): WP_REST_Response
   {
      $queue = JVB()->queue();
      $depends_on = [];
@@ -893,19 +900,23 @@
            $depends_on[] = $info['depends_on'];
         }
      }
      $queueData = [
         'depends_on' => $depends_on,
      ];
      if ($operationId) {
         $queueData['operation_id'] = $operationId;
      }
      $operationID = $queue->queueOperation(
         'update_image_meta',
         $user,
         $data,
         [
            'depends_on' => $depends_on,
         ]
         $queueData
      );
      return $this->sendResponse(
         true,
         [
            'operation_id' => $operationID,
            'operation_id' => $operationID['operation_id']??$operationId,
            'message'      => "Successfully queued ".count($data)." of {$original} meta updates"
         ],
         'Metadata update queued - will apply after upload completes'