Skip to content

Conversation

@BrayanDSO
Copy link
Member

Approach

In the commits

How Has This Been Tested?

Emulator 31:

  1. Go to deck options > Advanced > Custom scheduler
  2. Add console.log("some message"); there
  3. Open the new study screen
  4. See the log in logcat

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@BrayanDSO BrayanDSO force-pushed the ref/js-conf branch 2 times, most recently from 3550914 to c1c06f6 Compare December 27, 2025 20:31
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Soft approve

while (!statesMutated) {
delay(50)
}
mutationSignal.await()
Copy link
Member

@david-allison david-allison Dec 28, 2025

Choose a reason for hiding this comment

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

Likely off-topic & could be moved to another issue.

I'm concerned there's no cancellation support.

What happens when a card is flipped, but this hasn't run yet? What if there's an error, or the code is slow?

Copy link
Member Author

@BrayanDSO BrayanDSO Dec 28, 2025

Choose a reason for hiding this comment

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

Functionally, the only difference in comparison with the previous approach is how it waits for the signal, i.e. while...delay(50) vs CompletableDeferred.await().

Should it have some kind of timeout instead of waiting indefinitely? Perhaps.

Is the custom scheduler logic convoluted? Yes. And that is a consequence of how Anki desktop is architectured. I'm mostly following how the desktop version make the reviewer work, even in a barely used setting like this one.

ReviewerFragmentTest tests if the custom scheduler is working, so that is covered.

Making the logic safer to future refactors need some integration tests, and I'm still far from them.

So, create another issue if you want. Or simply wait until this turns into a problem (or not).

also made it use its ConfigKey constant
1. latency is better (e.g. if the JS code finishes 1ms after a check, it doesn't need to wait 49ms for a new check)
2. it's more efficient
3. it's cleaner

tested by adding `console.log("some message");` in the custom scheduler
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Wasn't expecting the infinite loops to be handled here, only flagging that they're an issue.

A TODO is probably the best call, it wouldn't meet 'priority: low' yet, but leaving that one up to you

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Second Approval Has one approval, one more approval to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants