Skip to content

Conversation

@david-allison
Copy link
Member

@david-allison david-allison commented Jan 4, 2026

Purpose / Description

Anki Desktop exposes 'Network timeout', we should do so as well.

https://forums.ankiweb.net/t/cant-sync-since-1-1-2026/68040/

Fixes

Approach

Expose it as a IncrementerNumberRangePreferenceCompat:

  • @string/sync_io_timeout_secs_key => syncIoTimeoutSecs
  • Default: 60s
  • Minimum: 30s
  • Max: 99999s

How Has This Been Tested?

Set in SyncAuth after being set in the UI to 30
Screenshot 2026-01-04 at 13 16 23

Truncated to avoid my hKey becoming public 😅

UI

Screenshot 2026-01-05 at 00 24 05 Screenshot 2026-01-05 at 00 23 43

⚠️ I had a failure in PrefsSearchBarTest, but I don't believe this is related

Learning (optional, can help others)

Exposed as SyncAuth.io_timeout_secs in the backend

https://github.com/ankitects/anki/blob/8f2144534bff6efedb22b7f052fba13ffe28cbc2/proto/anki/sync.proto#L29-L33

Upstream exposes this as a '60 seconds' textbox with an up/down picker

https://github.com/ankitects/anki/blob/8f2144534bff6efedb22b7f052fba13ffe28cbc2/qt/aqt/profiles.py#L734-L735 https://github.com/ankitects/anki/blob/8f2144534bff6efedb22b7f052fba13ffe28cbc2/qt/aqt/forms/preferences.ui#L718-L742

Checklist

  • 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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2026

Important

Maintainers: This PR contains Strings changes

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

@david-allison david-allison added the Review High Priority Request for high priority review label Jan 4, 2026
Copy link
Member

@BrayanDSO BrayanDSO left a comment

Choose a reason for hiding this comment

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

I think that a NumberRangePreferenceCompat would be a better fit than SliderPreference

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 4, 2026
@david-allison
Copy link
Member Author

david-allison commented Jan 4, 2026

ChatGPT agreed.

I would like to improve the UI of the control, it's a bit naff:

Tested with a new install and with a custom value

Screenshot 2026-01-05 at 00 24 05 Screenshot 2026-01-05 at 00 23 43

@david-allison david-allison removed the Needs Author Reply Waiting for a reply from the original author label Jan 4, 2026
Exposed as `SyncAuth.io_timeout_secs` in the backend

https://github.com/ankitects/anki/blob/8f2144534bff6efedb22b7f052fba13ffe28cbc2/proto/anki/sync.proto#L29-L33

**UI**
Upstream exposes this as a '60 seconds' textbox with an up/down picker

We expose it as a NumberRangePreferenceCompat:
* `@string/sync_io_timeout_secs_key` => `syncIoTimeoutSecs`
* Default: 60s
* Minimum: 30s
* Max: 99999s

https://github.com/ankitects/anki/blob/8f2144534bff6efedb22b7f052fba13ffe28cbc2/qt/aqt/profiles.py#L734-L735
https://github.com/ankitects/anki/blob/8f2144534bff6efedb22b7f052fba13ffe28cbc2/qt/aqt/forms/preferences.ui#L718-L742

Fixes 20000
@BrayanDSO BrayanDSO added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Jan 5, 2026
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

LGTM - can do an alpha shortly

@mikehardy mikehardy added this pull request to the merge queue Jan 5, 2026
@mikehardy mikehardy added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Review High Priority Request for high priority review Needs Second Approval Has one approval, one more approval to merge labels Jan 5, 2026
Merged via the queue into ankidroid:main with commit 25aeacf Jan 5, 2026
15 checks passed
@github-actions github-actions bot added this to the 2.24 release milestone Jan 5, 2026
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Jan 5, 2026
@david-allison david-allison deleted the network-timeout branch January 5, 2026 13:16
@peterj71
Copy link

peterj71 commented Jan 6, 2026

I just tested [AnkiDroid-2.24.0alpha2.parallel.A.apk] and the menu option appears fine and the 30s minimum works too (I put 6s and it auto-corrected to 30s).

Meanwhile the network routes from Optus Australia to Europe have improved since 1st Jan so my syncing pretty fast now and doesn't timeout (traceroute has improved from 33.5s and 22.5s).

Thanks again guys and BTW if you need to test this in future note that a partial sync is unlikely to timeout – it was only when I was doing full syncs owing to field changes in my note types that the problem occurred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network Timeout

4 participants