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/api/s2s/user/statusget.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'internal/api') diff --git a/internal/api/s2s/user/statusget.go b/internal/api/s2s/user/statusget.go index d16026d40..3dee0c88a 100644 --- a/internal/api/s2s/user/statusget.go +++ b/internal/api/s2s/user/statusget.go @@ -22,6 +22,7 @@ import ( "encoding/json" "fmt" "net/http" + "strings" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" @@ -35,13 +36,15 @@ func (m *Module) StatusGETHandler(c *gin.Context) { "url": c.Request.RequestURI, }) - requestedUsername := c.Param(UsernameKey) + // usernames on our instance are always lowercase + requestedUsername := strings.ToLower(c.Param(UsernameKey)) if requestedUsername == "" { c.JSON(http.StatusBadRequest, gin.H{"error": "no username specified in request"}) return } - requestedStatusID := c.Param(StatusIDKey) + // status IDs on our instance are always uppercase + requestedStatusID := strings.ToUpper(c.Param(StatusIDKey)) if requestedStatusID == "" { c.JSON(http.StatusBadRequest, gin.H{"error": "no status id specified in request"}) return -- cgit v1.2.3