Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Don't user upsert to persist new one time keys #2053
Conversation
erikjohnston
assigned
richvdh
Mar 23, 2017
|
Oh, I suppose I should raise a more helpful exception |
|
(I'm now raising a slightly more helpful exception) |
richvdh
requested changes
Mar 24, 2017
can we change it to include the algorithm in the table key?
| + # First we check if we have already persisted any of the keys. | ||
| + rows = yield self._simple_select_many_batch( | ||
| + table="e2e_one_time_keys_json", | ||
| + column="key_id", |
richvdh
Mar 24, 2017
Member
technically the algorithm is part of the key - so it's valid to have an "ed25519:aaaaa" as well as a "rot13:aaaaa". I rather hope the index reflects that, but haven't checked...
| + # We are protected from race between lookup and insertion due to | ||
| + # a unique constraint. If there is a race of two calls to | ||
| + # `add_e2e_one_time_keys` then they'll conflict and we will only | ||
| + # insert one set. |
richvdh
Mar 24, 2017
Member
... and throw a 500 or something, presumably? I suppose that's fine because the client should retry on the 500 and hit the api again, at which point the lookup should conclude that it's all fine.
richvdh
assigned
erikjohnston
and unassigned
richvdh
Mar 24, 2017
erikjohnston
assigned
richvdh
and unassigned
erikjohnston
Mar 28, 2017
|
modulo test failures. what's all that about? |
richvdh
assigned
erikjohnston
and unassigned
richvdh
Mar 29, 2017
erikjohnston
added some commits
Mar 29, 2017
|
Whoops, look like I was a crank. Hopefully fixed now. |
erikjohnston commentedMar 23, 2017
Instead we no-op duplicate one time key uploads, an error if the key_id
already exists but encodes a different key.