Page MenuHomePhabricator

[keyserver] Improve SQL performance in deleteInaccessibleThreads
ClosedPublic

Authored by ashoat on Aug 16 2023, 11:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 10:26 AM
Unknown Object (File)
Tue, Nov 12, 9:37 AM
Unknown Object (File)
Tue, Nov 12, 8:07 AM
Unknown Object (File)
Tue, Nov 12, 2:06 AM
Unknown Object (File)
Oct 13 2024, 3:08 PM
Unknown Object (File)
Oct 10 2024, 9:25 AM
Unknown Object (File)
Oct 10 2024, 9:25 AM
Unknown Object (File)
Oct 10 2024, 9:20 AM
Subscribers
None

Details

Summary

This has a similar problem to the parent diff. I refactored it to use two queries, the second of which is the same as in the parent diff.

Depends on D8837

Test Plan
  1. Performance: I tested the query on my production keyserver and found that it took less than 0.1s.
  2. Correctness: I created an "inaccessible thread" in my local dev environment by manually running an INSERT INTO threads query. I then triggered the cronjob manually by changing the time it runs, and confirmed my new thread was deleted. I also ran it when no threads needed to be deleted, and confirmed nothing happened via console.loging the code in the function.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The diff here is kind of hard to read. What I did was:

  1. Extract the SQL query I crafted in the previous diff into a new function deleteThreadsFromDB.
  2. Split deleteInaccessibleThreads into two queries, the first of which simply finds the inaccessible threads, and the second being a call to deleteThreadsFromDB.
This revision is now accepted and ready to land.Aug 16 2023, 11:52 AM