Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/jobs/ProcessBulkOperationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,18 @@ protected function loadData(): Batchable
$this->tempFilePath = Assets::tempFilePath('jsonl');
}

$fileExists = file_exists($this->tempFilePath);
$fileSize = $fileExists ? filesize($this->tempFilePath) : 0;

// If somehow a zero-byte file exists, remove it to force a re-download
if ($fileExists && $fileSize === 0) {
FileHelper::unlink($this->tempFilePath);
$fileExists = false;
}

// Only re-download if the file doesn't already exist
// If the queue is using multiple workers and the file leaks between them,
if (!file_exists($this->tempFilePath)) {
if (!$fileExists) {
// Retrieve remote file contents
$client = Craft::createGuzzleClient();
$response = $client->get($this->dataUrl);
Expand Down
Loading