Skip to content

Commit

Permalink
fix(db): remove excessive row-locking
Browse files Browse the repository at this point in the history
  • Loading branch information
BastiDood committed Aug 13, 2024
1 parent 0eb8173 commit 5a684f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion database/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export class Database implements Loggable {
@timed async getDesignatedSenderCredentials() {
const sql = this.#sql;
const [first, ...rest] =
await sql`SELECT email, given_name, family_name, access_token, refresh_token, expiration FROM drap.designated_sender JOIN drap.candidate_senders cs USING (email) JOIN drap.users USING (email) WHERE user_id IS NOT NULL AND is_admin AND lab_id IS NULL FOR UPDATE OF cs`;
await sql`SELECT email, given_name, family_name, access_token, refresh_token, expiration FROM drap.designated_sender JOIN drap.candidate_senders cs USING (email) JOIN drap.users USING (email) WHERE user_id IS NOT NULL AND is_admin AND lab_id IS NULL`;
strictEqual(rest.length, 0);
return typeof first === 'undefined' ? null : parse(DesignatedSenderCredentials, first);
}
Expand Down

0 comments on commit 5a684f1

Please sign in to comment.