mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-12-28 17:44:54 -05:00
Made use of LoggingStopwatch
This commit is contained in:
parent
d097cc8471
commit
58a1f9bab8
2 changed files with 7 additions and 9 deletions
|
@ -4,6 +4,7 @@ import PublisherTarget from "./publishing/publisher-target";
|
|||
import { getInputAsObject, mapNumberInput } from "./utils/input-utils";
|
||||
import { getDefaultLogger } from "./utils/logger-utils";
|
||||
import { retry } from "./utils/function-utils";
|
||||
import LoggingStopwatch from "./utils/logging-stopwatch";
|
||||
|
||||
async function main() {
|
||||
const commonOptions = getInputAsObject();
|
||||
|
@ -25,8 +26,7 @@ async function main() {
|
|||
const retryDelay = mapNumberInput(options.retryDelay);
|
||||
|
||||
const publisher = publisherFactory.create(target, logger);
|
||||
logger.info(`Publishing assets to ${targetName}...`);
|
||||
const start = new Date();
|
||||
const stopwatch = LoggingStopwatch.startNew(logger, `Publishing assets to ${targetName}...`, ms => `Successfully published assets to ${targetName} (in ${ms} ms)`);
|
||||
|
||||
await retry({
|
||||
func: () => publisher.publish(files, options),
|
||||
|
@ -38,8 +38,7 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const end = new Date();
|
||||
logger.info(`Successfully published assets to ${targetName} (in ${end.getTime() - start.getTime()} ms)`);
|
||||
stopwatch.stop();
|
||||
publishedTo.push(targetName);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import PublisherTarget from "../publisher-target";
|
|||
import Dependency from "../../metadata/dependency";
|
||||
import DependencyKind from "../../metadata/dependency-kind";
|
||||
import { mapBooleanInput, mapEnumInput } from "../../utils/input-utils";
|
||||
import LoggingStopwatch from "../../utils/logging-stopwatch";
|
||||
|
||||
enum UnfeatureMode {
|
||||
None = 0,
|
||||
|
@ -68,9 +69,8 @@ export default class ModrinthPublisher extends ModPublisher {
|
|||
}
|
||||
|
||||
private async unfeatureOlderVersions(id: string, token: string, unfeatureMode: UnfeatureMode, loaders: string[], gameVersions: string[]): Promise<void> {
|
||||
this.logger.info("Unfeaturing older Modrinth versions...");
|
||||
const start = new Date();
|
||||
const unfeaturedVersions = <string[]>[];
|
||||
const unfeaturedVersions = new Array<string>();
|
||||
const stopwatch = LoggingStopwatch.startNew(this.logger, "Unfeaturing older Modrinth versions...", ms => `Successfully unfeatured: ${unfeaturedVersions.join(", ")} (in ${ms} ms)`);
|
||||
|
||||
const versionSubset = hasFlag(unfeatureMode, UnfeatureMode.VersionSubset);
|
||||
const loaderSubset = hasFlag(unfeatureMode, UnfeatureMode.LoaderSubset);
|
||||
|
@ -92,8 +92,7 @@ export default class ModrinthPublisher extends ModPublisher {
|
|||
}
|
||||
|
||||
if (unfeaturedVersions.length) {
|
||||
const end = new Date();
|
||||
this.logger.info(`Successfully unfeatured versions ${unfeaturedVersions.join(", ")} (in ${end.getTime() - start.getTime()} ms)`);
|
||||
stopwatch.stop();
|
||||
} else {
|
||||
this.logger.info("No versions to unfeature were found");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue