From f046d9cc68e6ba138193fb941f12cb69d39d6df0 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 1 Jun 2024 21:55:58 +0100 Subject: [PATCH] add time taken to paste api and fixed text size on the creation page --- .../java/cc/fascinated/backend/service/PasteService.java | 6 ++++-- src/main/resources/templates/index.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/cc/fascinated/backend/service/PasteService.java b/src/main/java/cc/fascinated/backend/service/PasteService.java index 03a192b..984b77f 100644 --- a/src/main/java/cc/fascinated/backend/service/PasteService.java +++ b/src/main/java/cc/fascinated/backend/service/PasteService.java @@ -45,6 +45,7 @@ public class PasteService { */ public String createPaste(String content) { int length = content.length(); + long before = System.currentTimeMillis(); log.info("Creating a new paste. (characters: {})", length); // Check if the content is too large. @@ -59,7 +60,7 @@ public class PasteService { System.currentTimeMillis(), content )); - log.info("Created a new paste with the id '{}'", paste.getId()); + log.info("Created a new paste with the id '{}' (took: {}ms)", paste.getId(), System.currentTimeMillis() - before); return paste.getId(); } @@ -71,6 +72,7 @@ public class PasteService { */ public Paste getPaste(String id) { log.info("Getting paste with the id '{}'", id); + long before = System.currentTimeMillis(); Optional paste = pasteRepository.findById(id); // The paste does not exist. @@ -78,7 +80,7 @@ public class PasteService { log.info("Paste with the id '{}' not found", id); throw new ResourceNotFoundException("Paste '%s' not found".formatted(id)); } - log.info("Got paste with the id '{}'", id); + log.info("Got paste with the id '{}' (took: {}ms)", id, System.currentTimeMillis() - before); return paste.get(); } } diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 24a5670..3a4ade7 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -12,7 +12,7 @@
-
+