Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Scheduler] Recuring messages not dispatched if cache TTL is less than the message frequency. #52911

Open
@bendavies

Description

@bendavies

Symfony version(s) affected

6.4.1/7.0.1

Description

There is a bug in the Symfony Scheduler component where the cache TTL is erroneously set to a value less than a Scheduler's Message Frequency.

This causes the Scheduler to not dispatch any recurring messages at all.

Using a Cache with a TLL less than a Scheduler's Message Frequency is obviously wrong.
There should be no TTL at all, but it seems Scheduler should be able to handle this the same as a cache miss at continue producing messages as if there was no cache used.

How to reproduce

Follow reproduction steps at https://github.com/bendavies/symfony-bug-52911

Possible Solution

Not really sure?

  1. Fix the bug so a cache miss (from a ttl expiry) does not stop recuring messages being generated.
  2. Warn if the provided cache has a default ttl? (should be zero for scheduler?).
  3. manually set $item->expiresAfter(0) at
    [$this->time, $this->index, $this->from] = $this->cache->get($this->name, fn () => [$now, -1, $now]) + [2 => $now];
    ?

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions