Skip to content

Improve handling of jobs #10886

Open
Open
@jonasraoni

Description

@jonasraoni

Extracted from #9822

  • Ensure jobs can be terminated gracefully (store the progress somewhere), and be careful with things that shouldn't be executed twice (e.g. sending an email)
  • The BaseJob have some default values (default timeout of 60s, backoff of 5s, etc), I think it's better to make it required instead of providing random default values. Forcing the programmer to fill in these values, it's also a good reminder to treat the exceptional cases.
  • It's difficult to estimate how long some jobs might run (e.g. a large installation might require much more time). So, I think the timeout should be removed (or have a really high value), if it's not possible to update the code to terminate gracefully (i.e. resume the work from where it stopped later).
  • Looks like the Laravel doesn't have a isTimedOut() method, we could add it and update the code to respect it (e.g. while (!$this->isTimedOut()) { doWork(); }) instead of using the $failOnTimeout = true, it sounds better for most of the cases. IMHO abruptly timeouts are good only to catch bad code (e.g. infinite loops)...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Housekeeping:1:TodoAny dependency management or refactor that would be nice to have some day.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions