HomePhabricator
Diffusion Comm 65e4193c4b28

[keyserver] Fix the pinned count MariaDB out of range issue

Description

[keyserver] Fix the pinned count MariaDB out of range issue

Summary:
Context is in ENG-4399. Currently, if the client sends the unpin or pin action twice in a row, we don't
validate it on the keyserver, and instead allow it. We definitely want to prevent two back to back pin actions for the same message, but even more so for two unpin actions since that throws an error on
the keyserver.

THe best way I found to address both cases is to check the status of the message (is it already pinned / unpinned), and compare the requested action. If they are the same, we know we should not duplicate the
pin/unpin action, and return early. Otherwise, if the pin status is being changed, we can just continue as normal.

Test Plan: Confirmed that by sending two back to back unpin or pin actions for the same message, only the first one causes a change. The second one is just returned early

Reviewers: atul, ginsu, ashoat, tomek

Reviewed By: ashoat, tomek

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8683

Details

Provenance
rohanAuthored on Jul 31 2023, 10:38 AM
Reviewer
ashoat
Differential Revision
D8683: [keyserver] Fix the pinned count MariaDB out of range issue
Parents
rCOMM6d543f16cb18: [lib] Fix typo
Branches
Unknown
Tags
Unknown