Do not add progress events to the queue if progress task is disabled.
This commit is contained in:
@@ -208,7 +208,8 @@ final class Webhooks
|
|||||||
|
|
||||||
$this->cache->set('requests', $items, new DateInterval('P3D'));
|
$this->cache->set('requests', $items, new DateInterval('P3D'));
|
||||||
|
|
||||||
if (false === $metadataOnly && true === $entity->hasPlayProgress() && !$entity->isWatched()) {
|
$pEnabled = (bool)env('WS_CRON_PROGRESS', false);
|
||||||
|
if ($pEnabled && false === $metadataOnly && true === $entity->hasPlayProgress() && !$entity->isWatched()) {
|
||||||
$progress = $this->cache->get('progress', []);
|
$progress = $this->cache->get('progress', []);
|
||||||
$progress[str_replace($itemId, ':tainted@', ':untainted@')] = $entity;
|
$progress[str_replace($itemId, ':tainted@', ':untainted@')] = $entity;
|
||||||
$this->cache->set('progress', $progress, new DateInterval('P3D'));
|
$this->cache->set('progress', $progress, new DateInterval('P3D'));
|
||||||
@@ -223,7 +224,7 @@ final class Webhooks
|
|||||||
'type' => $entity->type,
|
'type' => $entity->type,
|
||||||
'played' => $entity->isWatched() ? 'Yes' : 'No',
|
'played' => $entity->isWatched() ? 'Yes' : 'No',
|
||||||
'queue_id' => $itemId,
|
'queue_id' => $itemId,
|
||||||
'progress' => $entity->hasPlayProgress() ? $entity->getPlayProgress() : null,
|
'progress' => $pEnabled && $entity->hasPlayProgress() ? $entity->getPlayProgress() : null,
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -740,7 +740,7 @@ final class DirectMapper implements iImport
|
|||||||
*/
|
*/
|
||||||
public function commit(): array
|
public function commit(): array
|
||||||
{
|
{
|
||||||
if (count($this->progressItems) >= 1) {
|
if (true === (bool)env('WS_CRON_PROGRESS', false) && count($this->progressItems) >= 1) {
|
||||||
try {
|
try {
|
||||||
$progress = $this->cache->get('progress', []);
|
$progress = $this->cache->get('progress', []);
|
||||||
foreach ($this->progressItems as $itemId => $entity) {
|
foreach ($this->progressItems as $itemId => $entity) {
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ final class MemoryMapper implements iImport
|
|||||||
public function commit(): mixed
|
public function commit(): mixed
|
||||||
{
|
{
|
||||||
if (true !== $this->inDryRunMode()) {
|
if (true !== $this->inDryRunMode()) {
|
||||||
if (count($this->progressItems) >= 1) {
|
if (true === (bool)env('WS_CRON_PROGRESS', false) && count($this->progressItems) >= 1) {
|
||||||
try {
|
try {
|
||||||
$progress = $this->cache->get('progress', []);
|
$progress = $this->cache->get('progress', []);
|
||||||
foreach ($this->progressItems as $itemId => $entity) {
|
foreach ($this->progressItems as $itemId => $entity) {
|
||||||
|
|||||||
Reference in New Issue
Block a user