Skip to content

Commit

Permalink
Make jobs as being manually run when manually run
Browse files Browse the repository at this point in the history
  • Loading branch information
dakota committed Mar 15, 2018
1 parent 42aabcb commit f5767be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/DelayedJob/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ class Job
* @var mixed
*/
protected $_brokerMessageBody;
/**
* Indicates that this job is being executed manually
*
* @var bool
*/
protected $_manualRun = false;

/**
* Job constructor.
Expand Down Expand Up @@ -155,6 +161,25 @@ public function __clone()
]);
}

/**
* @return bool
*/
public function isManualRun(): bool
{
return $this->_manualRun;
}

/**
* @param bool $manualRun
* @return self
*/
public function setManualRun(bool $manualRun): self
{
$this->_manualRun = $manualRun;

return $this;
}

/**
* @return array
*/
Expand Down
1 change: 1 addition & 0 deletions src/Shell/Task/WorkerTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function executeJob(Job $job)
$this->out(' - Executing job', 1, Shell::VERBOSE);
$this->djLog(__('Executing: {0}', $job->getId()));

$job->setManualRun(true);
$start = microtime(true);
$response = JobManager::instance()->execute($job, $this->param('force'));
$this->djLog(__('Done with: {0}', $job->getId()));
Expand Down

0 comments on commit f5767be

Please sign in to comment.