Skip to content

Instantly share code, notes, and snippets.

@rande
Created April 3, 2012 19:27
Show Gist options
  • Save rande/2294925 to your computer and use it in GitHub Desktop.
Save rande/2294925 to your computer and use it in GitHub Desktop.
/**
* {@inheritdoc}
*/
public function getStatus()
{
$states = $this->messageManager->countStates();
if ($states[MessageInterface::STATE_OPEN] > $this->checkLevel[MessageInterface::STATE_OPEN]) {
return new BackendStatus(BackendStatus::CRITICAL, 'Too much messages waiting to be processed');
}
if ($states[MessageInterface::STATE_IN_PROGRESS] > $this->checkLevel[MessageInterface::STATE_IN_PROGRESS]) {
return new BackendStatus(BackendStatus::FAILURE, 'Too many messages processed at the same time');
}
if ($states[MessageInterface::STATE_ERROR] > $this->checkLevel[MessageInterface::STATE_ERROR]) {
return new BackendStatus(BackendStatus::FAILURE, 'Too many errors');
}
if ($states[MessageInterface::STATE_DONE] > $this->checkLevel[MessageInterface::STATE_DONE]) {
return new BackendStatus(BackendStatus::CRITICAL, 'Too many processed messages, please clean the database');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment