fix: createFactRetriever not supporting timeout
Signed-off-by: Niek te Grootenhuis <niek.te.grootenhuis@alliander.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-tech-insights-backend': minor
|
||||
'@backstage/plugin-tech-insights-node': minor
|
||||
---
|
||||
|
||||
Support for timeout in FactRetrieverRegistrationOptions
|
||||
@@ -13,11 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { HumanDuration } from '@backstage/backend-tasks';
|
||||
import {
|
||||
FactLifecycle,
|
||||
FactRetriever,
|
||||
FactRetrieverRegistration,
|
||||
} from '@backstage/plugin-tech-insights-node';
|
||||
import { Duration } from 'luxon';
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -31,6 +33,7 @@ export type FactRetrieverRegistrationOptions = {
|
||||
cadence: string;
|
||||
factRetriever: FactRetriever;
|
||||
lifecycle?: FactLifecycle;
|
||||
timeout: Duration | HumanDuration;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -64,10 +67,11 @@ export type FactRetrieverRegistrationOptions = {
|
||||
export function createFactRetrieverRegistration(
|
||||
options: FactRetrieverRegistrationOptions,
|
||||
): FactRetrieverRegistration {
|
||||
const { cadence, factRetriever, lifecycle } = options;
|
||||
const { cadence, factRetriever, lifecycle, timeout } = options;
|
||||
return {
|
||||
cadence,
|
||||
factRetriever,
|
||||
lifecycle,
|
||||
timeout,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^0.15.0",
|
||||
"@backstage/backend-tasks": "^0.3.4",
|
||||
"@backstage/config": "^1.0.1",
|
||||
"@backstage/plugin-tech-insights-common": "^0.2.6",
|
||||
"@backstage/types": "^1.0.0",
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
TokenManager,
|
||||
} from '@backstage/backend-common';
|
||||
import { Logger } from 'winston';
|
||||
import { HumanDuration } from '@backstage/backend-tasks';
|
||||
|
||||
/**
|
||||
* A container for facts. The shape of the fact records needs to correspond to the FactSchema with same `ref` value.
|
||||
@@ -270,7 +271,7 @@ export type FactRetrieverRegistration = {
|
||||
* defaults to 5 minutes.
|
||||
*
|
||||
*/
|
||||
timeout?: Duration;
|
||||
timeout?: Duration | HumanDuration;
|
||||
|
||||
/**
|
||||
* Fact lifecycle definition
|
||||
|
||||
Reference in New Issue
Block a user