mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: batch connection logs to avoid DB lock contention (#23727)
- Running 30k connections was generating a ton of lock contention in the DB
This commit is contained in:
@@ -535,7 +535,7 @@ func (p *DBTokenProvider) connLogInitRequest(w http.ResponseWriter, r *http.Requ
|
||||
Int32: statusCode,
|
||||
Valid: true,
|
||||
},
|
||||
Ip: database.ParseIP(ip),
|
||||
IP: database.ParseIP(ip),
|
||||
UserAgent: sql.NullString{Valid: userAgent != "", String: userAgent},
|
||||
UserID: uuid.NullUUID{
|
||||
UUID: userID,
|
||||
|
||||
@@ -1281,7 +1281,7 @@ func assertConnLogContains(t *testing.T, rr *httptest.ResponseRecorder, r *http.
|
||||
WorkspaceName: workspace.Name,
|
||||
AgentName: agentName,
|
||||
Type: typ,
|
||||
Ip: database.ParseIP(r.RemoteAddr),
|
||||
IP: database.ParseIP(r.RemoteAddr),
|
||||
UserAgent: sql.NullString{Valid: r.UserAgent() != "", String: r.UserAgent()},
|
||||
Code: sql.NullInt32{
|
||||
Int32: int32(resp.StatusCode), // nolint:gosec
|
||||
|
||||
Reference in New Issue
Block a user