Adjust to review by making schedule optional

Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2023-08-09 11:45:44 +02:00
parent 5c56236eeb
commit 1bceb3049b
2 changed files with 9 additions and 17 deletions
+2 -2
View File
@@ -15,7 +15,7 @@
*/
import { TaskScheduleDefinition } from '@backstage/backend-tasks';
import { HumanDuration } from '@backstage/types';
import { HumanDuration, JsonObject } from '@backstage/types';
export interface Config {
/** Configuration options for the linguist plugin */
@@ -40,7 +40,7 @@ export interface Config {
/**
* [linguist-js](https://www.npmjs.com/package/linguist-js) options
*/
linguistJsOptions?: object;
linguistJsOptions?: JsonObject;
/** Options for the tags processor */
tagsProcessor?: {
+7 -15
View File
@@ -19,20 +19,11 @@ import {
coreServices,
createBackendPlugin,
} from '@backstage/backend-plugin-api';
import {
TaskScheduleDefinition,
readTaskScheduleDefinitionFromConfig,
} from '@backstage/backend-tasks';
import { readTaskScheduleDefinitionFromConfig } from '@backstage/backend-tasks';
import { HumanDuration } from '@backstage/types';
import { createRouter } from './service/router';
const DEFAULT_SCHEDULE: TaskScheduleDefinition = {
frequency: { minutes: 2 },
timeout: { minutes: 15 },
initialDelay: { seconds: 15 },
};
/**
* Linguist backend plugin
*
@@ -62,11 +53,12 @@ export const linguistPlugin = createBackendPlugin({
tokenManager,
httpRouter,
}) {
const schedule = config.has('linguist.schedule')
? readTaskScheduleDefinitionFromConfig(
config.getConfig('linguist.schedule'),
)
: DEFAULT_SCHEDULE;
let schedule;
if (config.has('linguist.schedule')) {
schedule = readTaskScheduleDefinitionFromConfig(
config.getConfig('linguist.schedule'),
);
}
const batchSize = config.getOptionalNumber('linguist.batchSize');
const useSourceLocation = config.getBoolean(
'linguist.useSourceLocation',