From a5852fd7e43bf97ea7def9de20cd6d02d954094d Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 2 May 2022 12:53:46 +0200 Subject: [performance] Speed up some of the slower db queries (#523) * remove unnecessary LOWER() db calls * warn during slow db queries * use bundb built-in exists function * add db block test * update account block query * add domain block db test * optimize domain block query * fix implementing wrong test * exclude most columns when checking block * go fmt * remote more unnecessary use of LOWER() --- internal/web/thread.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'internal/web/thread.go') diff --git a/internal/web/thread.go b/internal/web/thread.go index 4a448690d..0450f6b26 100644 --- a/internal/web/thread.go +++ b/internal/web/thread.go @@ -36,14 +36,16 @@ func (m *Module) threadTemplateHandler(c *gin.Context) { ctx := c.Request.Context() - username := c.Param(usernameKey) + // usernames on our instance will always be lowercase + username := strings.ToLower(c.Param(usernameKey)) if username == "" { c.JSON(http.StatusBadRequest, gin.H{"error": "no account username specified"}) return } - statusID := c.Param(statusIDKey) - if username == "" { + // status ids will always be uppercase + statusID := strings.ToUpper(c.Param(statusIDKey)) + if statusID == "" { c.JSON(http.StatusBadRequest, gin.H{"error": "no status id specified"}) return } -- cgit v1.2.3