Repository navigation
1.5.0
1.5.0 is mostly about Redis as the job store: a node that loses its connection to Redis now stops its own jobs before another node starts them again, applications with ticker types of their own can use the store, and records left by a version before 1.3.0 are read. It also fixes crons that never ran (a five-field value from configuration, the official MySQL provider on net8.0) and a cron that kept its old schedule after a deploy. No database migration for EF Core, no change of the MongoDB collections, no new Redis key. Please read Behaviour changes before deploying: with Redis as the job store, running jobs can now be asked to stop and run again in a Redis outage.
Fixed
Redis as the job store
- A node cut off from Redis stops its jobs before they are started again (#46). A node that cannot write its heartbeat for one heartbeat TTL (80 seconds with the default interval) asks its running jobs to stop and starts none until its heartbeat is written again. Jobs that stop are put back and run again. Before, the other nodes released the jobs of the silent node while they could still be running on it.
StopJobsWhenHeartbeatIsLost = falseon the Redis options turns this off. - An application's own ticker types work (#162). Adding a job failed without a
JsonSerializerContext, and with a source-generated one the scheduler loop and the fallback failed on reading the jobs. Both work now, without a setting for the serializer. - Records left by a version before 1.3.0 are read (#144, #145). Time jobs that such a version left
InProgressare released when the instance starts under theNodeIdentifierthat holds them, and run. A chain stored inside its parent's record gets its children written as records of their own when the parent is taken to run, and they run by their run conditions. - A job whose own ticker type has an empty collection runs (#146). Such a job was claimed and not handed out, and stayed
InProgress. - One record that cannot be read no longer stops the others (#150). The record is left out of the read and logged as a warning with its key.
- A job added shortly before it is due starts at its time (#176). The scheduler loop did not take such a job when the last digit of its
UpdatedAtwas a zero, about one job in ten; the fallback started it up toFallbackIntervalChecker(30 seconds by default) late.
Crons
- A cron from configuration (
%Key%) with five fields runs (first part of #79). It was stored as it was and never ran. A value that is not a cron expression now stops the startup with an error that names the function, the key and the value. - Crons run on the official MySQL provider on net8.0 (#91).
SharpTicker.EntityFrameworkCoreasks forFlexLabs.EntityFrameworkCore.Upsert8.1.2 or later on net8.0. - A cron changed in code runs on its new schedule after a deploy, with the EF Core store and Redis next to it (#93). The list of cron expressions kept in Redis is cleared when the crons are seeded at startup and ends ten minutes after it was read.
Other
- A job whose cancellation callback throws no longer breaks the stop of the application (#73). The stop logs a warning and waits for the running jobs as before.
- MongoDB: the fallback takes a job only as it read it (#55). A job rescheduled in between could run early with its old payload.
New in the log
- EF Core without Redis: a starting instance writes one Information entry that names the other node identifiers holding
InProgressjobs, with their counts (first part of #24). Nothing is released by it. - Redis as the job store: an Error when the node stops its jobs because its heartbeat could not be written, and an Information entry when it starts jobs again.
- EF Core with Redis: a Warning when the cached cron list cannot be cleared at startup.
Behaviour changes to check before upgrading
- With Redis as the job store, running jobs are asked to stop when the node cannot write its heartbeat for one TTL, and they run again later. This also happens in a Redis outage that every instance sees, where the jobs ran on before. Check that your jobs honour their cancellation token and are safe to run twice. Jobs that must not be interrupted that way need
StopJobsWhenHeartbeatIsLost = false. - Stored jobs that did not run before can run after the upgrade. On a Redis store that was ever used by a version before 1.3.0: time jobs left
InProgress, and the children of chains whose parent has not run yet. With ticker types of your own: jobs that stayedInProgressbecause of an empty collection. Delete the ones that should not run before upgrading; Upgrading says where to look. - A configured cron value that is not a cron expression stops the startup. Up to 1.4.0 the application started and the job never ran. A five-field value that never ran starts to run. Check the configured values.
- EF Core on net8.0: a project that pins
FlexLabs.EntityFrameworkCore.Upsertbelow 8.1.2 gets a restore error until the pin is raised. - EF Core with Redis: a cron list entry written by 1.4.0 or earlier has no end. The first start on 1.5.0 clears it when it seeds; an instance still on the earlier version writes it again.
- Redis: jobs added shortly before they are due start earlier than they did, and fewer end
DueDone.
Upgrade
From 1.4.0: no schema step. Upgrade all instances together: an instance on 1.4.0 behaves as 1.4.0 did for the jobs it runs, takes a chain stored before 1.3.0 without its children, and writes the cron list entry without an end.
Known limits
- A job that ignores its cancellation token runs on after its node was cut off from Redis, and can then run a second time on another node.
- The stop of a node's jobs applies to Redis as the job store. With the EF Core or MongoDB store and the Redis heartbeat next to it, nothing changes.
- EF Core without Redis: jobs held under a node name that no instance starts with again stay
InProgress(#24). - Redis with ticker types of your own: a number with more than 14 digits in such a type is rewritten by the store's scripts, and the job is not handed out (#151). Values of abstract types need polymorphism configured.
- A chain stored before 1.3.0 whose parent already ended is left as it is; delete it and add it again for its children to run.
- A stored cron that has no next occurrence logs nothing (#79).
- MongoDB has no release step for a node that stopped (#140).