diff --git a/.changeset/dull-windows-carry.md b/.changeset/dull-windows-carry.md new file mode 100644 index 0000000000..fb259f1e56 --- /dev/null +++ b/.changeset/dull-windows-carry.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': minor +--- + +**BREAKING**: Removed unused `durationText` utility. diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index d97df9967c..00040a19e3 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -580,11 +580,6 @@ export type DeferredEntity = { locationKey?: string; }; -// Warning: (ae-missing-release-tag) "durationText" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public -export function durationText(startTimestamp: [number, number]): string; - // @public (undocumented) export type EntitiesCatalog = { entities(request?: EntitiesRequest): Promise; diff --git a/plugins/catalog-backend/src/util/index.ts b/plugins/catalog-backend/src/util/index.ts index 2e592fb8df..13a9c84b0f 100644 --- a/plugins/catalog-backend/src/util/index.ts +++ b/plugins/catalog-backend/src/util/index.ts @@ -16,4 +16,3 @@ export * from './runPeriodically'; export * from './RecursivePartial'; -export * from './timing'; diff --git a/plugins/catalog-backend/src/util/timing.ts b/plugins/catalog-backend/src/util/timing.ts deleted file mode 100644 index b5f9eb258f..0000000000 --- a/plugins/catalog-backend/src/util/timing.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2020 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Returns a string with the elapsed time since the start of an operation, - * with some human friendly precision, e.g. "133ms" or "14.5s". - * - * @param startTimestamp - The timestamp (from process.hrtime()) at the start ot - * the operation - */ -export function durationText(startTimestamp: [number, number]): string { - const delta = process.hrtime(startTimestamp); - const seconds = delta[0] + delta[1] / 1e9; - if (seconds > 1) { - return `${seconds.toFixed(1)}s`; - } - return `${(seconds * 1000).toFixed(0)}ms`; -}