diff --git a/.changeset/dirty-clocks-poke.md b/.changeset/dirty-clocks-poke.md new file mode 100644 index 0000000000..3eb63ee7a2 --- /dev/null +++ b/.changeset/dirty-clocks-poke.md @@ -0,0 +1,18 @@ +--- +'@backstage/backend-tasks': patch +--- + +`TaskScheduleDefinition` has been updated to also accept an options object containing duration information in the form of days, hours, seconds and so on. This allows for scheduling without importing `luxon`. + +```diff +-import { Duration } from 'luxon'; +// omitted other code + +const schedule = env.scheduler.createScheduledTaskRunner({ +- frequency: Duration.fromObject({ minutes: 10 }), +- timeout: Duration.fromObject({ minutes: 15 }), ++ frequency: { minutes: 10 }, ++ timeout: { minutes: 15 }, + // omitted other code +}); +``` diff --git a/.changeset/fast-stingrays-guess.md b/.changeset/fast-stingrays-guess.md new file mode 100644 index 0000000000..044dfff856 --- /dev/null +++ b/.changeset/fast-stingrays-guess.md @@ -0,0 +1,36 @@ +--- +'@backstage/create-app': patch +--- + +Simplified the search collator scheduling by removing the need for the `luxon` dependency. + +For existing installations the scheduling can be simplified by removing the `luxon` dependency and using the human friendly duration object instead. +Please note that this only applies if luxon is not used elsewhere in your installation. + +`packages/backend/package.json` + +```diff + "express": "^4.17.1", + "express-promise-router": "^4.1.0", +- "luxon": "^2.0.2", +``` + +`packages/backend/src/plugins/search.ts` + +```diff + import { Router } from 'express'; +-import { Duration } from 'luxon'; + + // omitted other code + + const schedule = env.scheduler.createScheduledTaskRunner({ +- frequency: Duration.fromObject({ minutes: 10 }), +- timeout: Duration.fromObject({ minutes: 15 }), ++ frequency: { minutes: 10 }, ++ timeout: { minutes: 15 }, + // A 3 second delay gives the backend server a chance to initialize before + // any collators are executed, which may attempt requests against the API. +- initialDelay: Duration.fromObject({ seconds: 3 }), ++ initialDelay: { seconds: 3 }, + }); +```