Merge pull request #9613 from backstage/rugvip/no-duration

catalog-backend: removed unused durationText helper
This commit is contained in:
Patrik Oldsberg
2022-02-17 14:49:49 +01:00
committed by GitHub
4 changed files with 5 additions and 37 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': minor
---
**BREAKING**: Removed unused `durationText` utility.
-5
View File
@@ -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<EntitiesResponse>;
@@ -16,4 +16,3 @@
export * from './runPeriodically';
export * from './RecursivePartial';
export * from './timing';
@@ -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`;
}