Skip to content

Commit ff5be44

Browse files
committed
refactor: Add fixme to (some) queries
1 parent 1c08e86 commit ff5be44

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tokenserver-db-sqlite/src/models.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SELECT rowid as id
44
FROM nodes
55
WHERE service = ?
66
AND node = ?"#;
7+
// FIXME: MySQL specific
78
pub const REPLACE_USERS_SYNC_QUERY: &str = r#"
89
UPDATE users
910
SET replaced_at = ?
@@ -30,6 +31,7 @@ AND email = ?
3031
AND generation <= ?
3132
AND COALESCE(keys_changed_at, 0) <= COALESCE(?, keys_changed_at, 0)
3233
AND replaced_at IS NULL"#;
34+
// FIXME: MySQL specific
3335
pub const POST_USER_SYNC_QUERY: &str = r#"
3436
INSERT INTO users (service, email, generation, client_state, created_at, nodeid, keys_changed_at, replaced_at)
3537
VALUES (?, ?, ?, ?, ?, ?, ?, ?);"#;
@@ -51,6 +53,7 @@ WHERE service = ?
5153
AND available <= 0
5254
AND capacity > current_load
5355
AND downed = 0"#;
56+
// FIXME: MySQL specific
5457
pub const GET_BEST_NODE_SPANNER_QUERY: &str = r#"
5558
SELECT id, node
5659
FROM nodes

tokenserver-db/src/models.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct DbInner {
5555

5656
impl TokenserverDb {
5757
// Note that this only works because an instance of `TokenserverDb` has *exclusive access* to
58-
// a connection from the r2d2 pool for its lifetime. `LAST_INSERT_ID()`/`LAST_INSERT_ROWID()`
58+
// a connection from the r2d2 pool for its lifetime. `LAST_INSERT_ID_QUERY`
5959
// returns the ID of the most recently-inserted record *for a given connection*.
6060
// If connections were shared across requests, using this function would introduce a race condition,
6161
// as we could potentially get IDs from records created during other requests.
@@ -163,7 +163,6 @@ impl TokenserverDb {
163163
.execute(&self.inner.conn)?;
164164

165165
diesel::sql_query(LAST_INSERT_ID_QUERY)
166-
.bind::<Text, _>(&user.email)
167166
.get_result::<results::PostUser>(&self.inner.conn)
168167
.map_err(Into::into)
169168
}

0 commit comments

Comments
 (0)