You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/03/10 00:30:53 UTC

[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #6632: Only update tm_user.last_authenticated once per minute

zrhoffman commented on a change in pull request #6632:
URL: https://github.com/apache/trafficcontrol/pull/6632#discussion_r823227102



##########
File path: traffic_ops/traffic_ops_golang/login/login.go
##########
@@ -63,7 +63,9 @@ WHERE name='tm.instance_name' AND
 `
 const userQueryByEmail = `SELECT EXISTS(SELECT * FROM tm_user WHERE email=$1)`
 const setTokenQuery = `UPDATE tm_user SET token=$1 WHERE email=$2`
-const UpdateLoginTimeQuery = `UPDATE tm_user SET last_authenticated = now() WHERE username=$1`
+
+// UpdateLoginTimeQuery is meant to only update the last_authenticated field once per minute in order to avoid row-locking when the same user logs in frequently.
+const UpdateLoginTimeQuery = `UPDATE tm_user SET last_authenticated = now() WHERE username=$1 AND last_authenticated < now() - INTERVAL '1 minute'`

Review comment:
       Since the other SQL keywords are uppercase, should `now()` be uppercase? Should `minute`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org