Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keys query scheduler #1676

Merged
merged 2 commits into from
Jan 11, 2023
Merged

Add keys query scheduler #1676

merged 2 commits into from
Jan 11, 2023

Conversation

Anderas
Copy link
Contributor

@Anderas Anderas commented Jan 9, 2023

Fixes #1668 and partially resolves #1670

Add MXKeysQueryScheduler used with crypto V2, which serves similar purpose as MXDeviceList serves in legacy crypto, albeit only focusing on optimizing keys/query requests.

Specifically it will:

  • ensure that only one keys/query request is in-flight at any given time
  • all further requests are aggregated, and if they contain any new users, will be executed right after the first one finishes

These optimizations should ensure that the application does not make unnecessary amout of queries, as we currently call the downloadKeys from far too many places. Note that I have previously tried to solve the current/next task in more generic way, but was missing the additional need to aggregate further users. So for now I am adding a case specific MXKeysQueryScheduler which may later evolve to more generic MXSerialTaskScheduler

In general the application should never query keys directly, except for very few cases (starting new room, refreshing cross signing), but this is not unfortunatelly the case at the moment. To start moving in the right direction I split out downloadKeysIfNecessary and a deprecated reloadKeys instead of passing forceDownload parameter. This should make it clearer which API to use.

@Anderas Anderas force-pushed the andy/query_scheduler branch from e84c3d1 to c7000e1 Compare January 9, 2023 09:38
@Anderas Anderas requested review from a team and gileluard and removed request for a team January 9, 2023 09:39
@Anderas Anderas force-pushed the andy/query_scheduler branch from c7000e1 to bc6cebf Compare January 9, 2023 09:45
Copy link
Contributor

@gileluard gileluard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍 It seems your updates are causing some regressions in the CI though and MXKeysQuerySchedulerUnitTests.test_executeEachAliceQuerySeparately is failing

@Anderas
Copy link
Contributor Author

Anderas commented Jan 10, 2023

lgtm 👍 It seems your updates are causing some regressions in the CI though and MXKeysQuerySchedulerUnitTests.test_executeEachAliceQuerySeparately is failing

Thanks, I actually forgot to add them to unit test plan as well, and missed the failure.

@Anderas Anderas merged commit 41a9445 into develop Jan 11, 2023
@Anderas Anderas deleted the andy/query_scheduler branch January 11, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants