Reduce logging in some circumstances to avoid log floods.
This commit is contained in:
parent
4bf668e4a6
commit
267e87320c
|
@ -9,7 +9,6 @@ use App\Event\Radio\AnnotateNextSong;
|
|||
use App\Radio\Backend\Liquidsoap\ConfigWriter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
final class Annotations implements EventSubscriberInterface
|
||||
|
@ -43,11 +42,11 @@ final class Annotations implements EventSubscriberInterface
|
|||
public function annotateNextSong(
|
||||
Entity\Station $station,
|
||||
bool $asAutoDj = false,
|
||||
): string {
|
||||
): string|bool {
|
||||
$queueRow = $this->queueRepo->getNextToSendToAutoDj($station);
|
||||
|
||||
if (null === $queueRow) {
|
||||
throw new RuntimeException('Queue is empty for station.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$event = AnnotateNextSong::fromStationQueue($queueRow, $asAutoDj);
|
||||
|
|
|
@ -21,7 +21,7 @@ final class NextSongCommand extends AbstractCommand
|
|||
Entity\Station $station,
|
||||
bool $asAutoDj = false,
|
||||
array $payload = []
|
||||
): string {
|
||||
): string|bool {
|
||||
return $this->annotations->annotateNextSong(
|
||||
$station,
|
||||
$asAutoDj
|
||||
|
|
|
@ -719,7 +719,6 @@ final class ConfigWriter implements EventSubscriberInterface
|
|||
|
||||
$customFunctionBody[] = ' current_time = time()';
|
||||
$customFunctionBody[] = ' result = (' . implode(' and ', $conditions) . ')';
|
||||
$customFunctionBody[] = ' log("' . implode(' and ', $conditions) . ' = #{result} (#{current_time})")';
|
||||
$customFunctionBody[] = ' result';
|
||||
$customFunctionBody[] = 'end';
|
||||
$event->appendLines($customFunctionBody);
|
||||
|
|
Loading…
Reference in New Issue