refactor: stop using backend-tasks in packages and plugins
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -41,7 +41,7 @@ The default schedule for the Catalog Collator is to run every 10 minutes, you ca
|
||||
search:
|
||||
collators:
|
||||
catalog:
|
||||
schedule: # same options as in TaskScheduleDefinition
|
||||
schedule: # same options as in SchedulerServiceTaskScheduleDefinition
|
||||
# supports cron, ISO duration, "human duration" as used in code
|
||||
initialDelay: { seconds: 90 }
|
||||
# supports cron, ISO duration, "human duration" as used in code
|
||||
@@ -85,7 +85,7 @@ The default schedule for the TechDocs Collator is to run every 10 minutes, you c
|
||||
search:
|
||||
collators:
|
||||
techdocs:
|
||||
schedule: # same options as in TaskScheduleDefinition
|
||||
schedule: # same options as in SchedulerServiceTaskScheduleDefinition
|
||||
# supports cron, ISO duration, "human duration" as used in code
|
||||
initialDelay: { seconds: 90 }
|
||||
# supports cron, ISO duration, "human duration" as used in code
|
||||
|
||||
@@ -86,7 +86,7 @@ Search chooses to completely rebuild indices on a schedule. Different collators
|
||||
can be configured to refresh at different intervals, depending on how often the
|
||||
source information is updated. When search indexing is distributed among multiple
|
||||
backend nodes, coordination to prevent clashes is typically handled by a
|
||||
distributed `TaskRunner`.
|
||||
distributed `SchedulerServiceTaskRunner`.
|
||||
|
||||
### The Search Page
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ Backstage Search builds and maintains its index
|
||||
[on a schedule](./concepts.md#the-scheduler). You can change how often the
|
||||
indexes are rebuilt for a given type of document. You may want to do this if
|
||||
your documents are updated more or less frequently. You can do so by configuring
|
||||
a scheduled `TaskRunner` to pass into the `schedule` value, like this:
|
||||
a scheduled `SchedulerServiceTaskRunner` to pass into the `schedule` value, like this:
|
||||
|
||||
```typescript {3}
|
||||
const every10MinutesSchedule = env.scheduler.createScheduledTaskRunner({
|
||||
@@ -302,16 +302,19 @@ indexBuilder.addCollator({
|
||||
```
|
||||
|
||||
Note: if you are using the in-memory Lunr search engine, you probably want to
|
||||
implement a non-distributed `TaskRunner` like the following to ensure consistency
|
||||
implement a non-distributed `SchedulerServiceTaskRunner` like the following to ensure consistency
|
||||
if you're running multiple search backend nodes (alternatively, you can configure
|
||||
the search plugin to use a non-distributed database such as
|
||||
[SQLite](../../tutorials/configuring-plugin-databases.md#postgresql-and-sqlite-3)):
|
||||
|
||||
```typescript
|
||||
import { TaskInvocationDefinition, TaskRunner } from '@backstage/backend-tasks';
|
||||
import {
|
||||
SchedulerServiceTaskRunner,
|
||||
SchedulerServiceTaskInvocationDefinition,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
const schedule: TaskRunner = {
|
||||
run: async (task: TaskInvocationDefinition) => {
|
||||
const schedule: SchedulerServiceTaskRunner = {
|
||||
run: async (task: SchedulerServiceTaskInvocationDefinition) => {
|
||||
const startRefresh = async () => {
|
||||
while (!task.signal?.aborted) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user