From 6ace1d996e51fcf721e5bed924a7474dceadd1e4 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Wed, 29 Dec 2021 12:41:08 -0600 Subject: [PATCH 1/2] Updated backend-tasks readme Signed-off-by: Andre Wanlin --- packages/backend-tasks/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/backend-tasks/README.md b/packages/backend-tasks/README.md index d3c361c02c..98c932de47 100644 --- a/packages/backend-tasks/README.md +++ b/packages/backend-tasks/README.md @@ -21,14 +21,19 @@ import { Duration } from 'luxon'; const scheduler = TaskScheduler.fromConfig(rootConfig).forPlugin('my-plugin'); await scheduler.scheduleTask({ - id: 'refresh-things', + id: 'refresh_things', frequency: Duration.fromObject({ minutes: 10 }), + timeout: Duration.fromObject({ minutes: 15 }), fn: async () => { await entityProvider.run(); }, }); ``` +## Local Development + +When working with backend-tasks you may run into your task not running as expected if you are using a persistent database. A table called "backstage_backend_tasks\_\_tasks" in the applicable plugin's database will contain a record with the next run date and time. You can delete this record to get things back to what you expect + ## Documentation - [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md) From e188b37024f58c2d65d036a3e7547c3160490168 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Thu, 30 Dec 2021 14:08:53 -0600 Subject: [PATCH 2/2] Feedback changes and changeset Signed-off-by: Andre Wanlin --- .changeset/two-rice-pull.md | 9 +++++++++ packages/backend-tasks/README.md | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/two-rice-pull.md diff --git a/.changeset/two-rice-pull.md b/.changeset/two-rice-pull.md new file mode 100644 index 0000000000..3c6138094d --- /dev/null +++ b/.changeset/two-rice-pull.md @@ -0,0 +1,9 @@ +--- +'@backstage/backend-tasks': patch +--- + +Updated README to clarify the following: + +- Dashes cannot be used in the `id`, changed to an underscore in the example +- The `timeout` is required, this was also added to the example +- Added a note about tasks not running as expected for local development using persistent database diff --git a/packages/backend-tasks/README.md b/packages/backend-tasks/README.md index 98c932de47..fe55f37afd 100644 --- a/packages/backend-tasks/README.md +++ b/packages/backend-tasks/README.md @@ -32,7 +32,7 @@ await scheduler.scheduleTask({ ## Local Development -When working with backend-tasks you may run into your task not running as expected if you are using a persistent database. A table called "backstage_backend_tasks\_\_tasks" in the applicable plugin's database will contain a record with the next run date and time. You can delete this record to get things back to what you expect +When working with the `@backstage/backend-tasks` library you may run into your task not running immediately at startup as expected if you are using a persistent database. This is by design - the library respects the previous state and does not run the task sooner than the specified frequency. If you want to get around this, there is a table called `backstage_backend_tasks__tasks` in the applicable plugin's database which will contain a record with the next run date and time. You can delete this record to get things back to what you expect. ## Documentation