1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Recurring tasks, such as a nightly report or an hourly cleanup, defined in Rust and run by a
//! single cron entry.
//!
//! A [`Schedule`] holds the tasks, which may be callbacks, application commands, programs, or
//! shell commands. Each [`Task`] sets its frequency, constraints, overlap and single-runner locks,
//! output, and hooks. The
//! [scheduling guide](https://github.com/laravel/rust-framework/blob/0.x/docs/scheduling.md)
//! walks through each of these.
//!
//! Define tasks in a [`#[schedule::tasks]`](macro@tasks) function,
//! [`ApplicationBuilder::with_schedule`](crate::foundation::ApplicationBuilder::with_schedule),
//! or [`Registrar::schedule`](crate::container::Registrar::schedule). In production, run the
//! application's `schedule:run` command every minute. Locally, run `schedule:work`, which calls
//! `schedule:run` every minute for you. Tasks run concurrently unless you mark them
//! [`Task::blocking`]. `schedule:run` waits for every task it starts, and it doesn't make up
//! minutes it missed. When a sub-minute task is due, `schedule:run` keeps running until the end of
//! that minute.
//!
//! ```
//! use laravel::Application;
//!
//! Application::configure().with_schedule(|schedule, _| {
//! schedule.call(|| async {}).name("prune").daily_at("02:00");
//! schedule.command("inspire").hourly();
//! });
//! ```
//!
//! `schedule:run` starts every task due in the current UTC minute, whatever second it starts in.
//! Running it twice in one minute runs its tasks twice, unless they use [`Task::on_one_runner`].
//! When a task fails, by returning an error, exiting with a nonzero status, or panicking, the
//! scheduler reports the failure and still runs the other tasks. If any task, constraint, hook, or
//! event listener fails, `schedule:run` exits with status `1`. On `SIGINT` or `SIGTERM`, it stops
//! starting new tasks and sub-minute repeats, and waits for the tasks that are already running.
//!
//! `schedule:interrupt` stops the sub-minute repeats of every `schedule:run` in progress that
//! uses the same cache store, and those runs exit once their running tasks finish. A run notices
//! the signal within a second, and a run that starts after the signal ignores it. With the
//! `memory` store, `schedule:interrupt` warns that other processes won't see the signal. With the
//! `discard` store, it fails.
//!
//! A sub-minute task's repeats count from when `schedule:run` started. For example, when
//! `schedule:run` starts at `12:00:23`, it runs an `every_ten_seconds` task right away, then
//! around `:33`, `:43`, and `:53`. Each repeat checks the task's constraints again. When a repeat
//! comes due while the previous run is still going, the scheduler skips that repeat instead of
//! queueing it, and it starts no repeats after the minute ends.
//!
//! `schedule:list --json` lists each task's `expression`, `command`, `description`,
//! `next_due_date`, `next_due_date_human`, `timezone`, `has_mutex`, `repeat_seconds`,
//! `environments`, and `on_one_server`. The `command` field shows an application command with an
//! `app` prefix, and a callback by its path. `has_mutex` is `true` while a run holds the task's
//! overlap lock. If a task has no occurrence in the next four years, `schedule:list --json` fails.
pub use __Registration;
pub use *;
pub use ;