HomePhabricator
Diffusion Comm f7bc1ceae2ea

[identity] fix add_reserved_usernames RPC

Description

[identity] fix add_reserved_usernames RPC

Summary:
Since there aren't that many users in the users table currently, it's cheaper to just get all the usernames from DDB and then compare with the list from keyserver using HashSets.

Also fixed the BatchWriteRequests -- DynamoDB didn't like that we were sending more than 25 items per request, so I broke up the usernames list into chunks of 25. Also, I removed the retry logic for unprocessed items because we should rarely have those.

Test Plan:

  1. Inserted 1000 new users with usernames into my local MariaDB users table.
  2. Ran the cron job that calls the AddReservedUsernames RPC.
  3. Confirmed that all the new usernames were in the prod DynamoDB reserved usernames table. Existing users (e.g. ashoat), were skipped.
  4. Cleared the DDB table.

Reviewers: jon, bartek

Reviewed By: bartek

Subscribers: ashoat, tomek

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

Details

Provenance
varunAuthored on Jul 25 2023, 1:59 PM
Reviewer
bartek
Differential Revision
D8631: [identity] fix add_reserved_usernames RPC
Parents
rCOMM4fa884052ece: [lib] refactor Message Store Operations to use generic type
Branches
Unknown
Tags
Unknown