Android: placing a server-driven Dynamic Widget fetches from the server twice
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- android, kotlin, react-native
- Ambito
- ai-infra-agents, mobile-dev
Direzione di ricerca
Start in packages/android-client/android/src/main/java/voltra/dynamicwidget/serverupdate/DynamicWidgetServerUpdateScheduler.kt, reading schedule(), enqueuePeriodic() and requestImmediateUpdate(), and check whether the periodic request is enqueued without an initial delay. Confirm the double fetch by counting requests with adb logcat -s VoltraDynamicServerSched. Done means one request per placement, with VoltraWidgetUpdateScheduler checked for the same pattern.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Follow-up to #293, where the reporter noticed it.
What happens
Placing a server-driven Dynamic Widget (a widget with both entry and serverUpdate) makes two identical HTTP requests to the server within the same second.
Reported on 2.3.0 with a physical device and a PHP endpoint logging every hit: two requests with the same timestamp each time the widget is added.
Likely cause (from reading the code, not yet confirmed on a device)
DynamicWidgetServerUpdateScheduler.schedule() does two things for a scope that has just been scheduled:
enqueuePeriodic(...)enqueues aPeriodicWorkRequestwith no initial delay. WorkManager runs the first execution of a periodic request as soon as its constraints are met, not after one interval.requestImmediateUpdate(...)(whenrunImmediatelyis true, whichrecompute()passes for a scope with no previous schedule) enqueues a separate expedited one-time request under the_oncework name.
Those are two different unique work names, so nothing collapses them, and both run DynamicWidgetServerUpdateRunner straight away.
Relevant code: packages/android-client/android/src/main/java/voltra/dynamicwidget/serverupdate/DynamicWidgetServerUpdateScheduler.kt (schedule, enqueuePeriodic, enqueueOneTime).
Expected
One fetch when a widget is placed.
Possible fix
Give the periodic request an initial delay of one interval (setInitialDelay) whenever the immediate one-time request is also enqueued, so the one-time request is the placement fetch and the periodic one takes over afterwards. The one-time request is the better one to keep because it is expedited.
VoltraWidgetUpdateScheduler (payload-driven widgets) also uses enqueueUniquePeriodicWork plus a requestImmediateUpdate; worth checking whether it has the same shape.
How to verify
Pin a server-driven Dynamic Widget on a device or emulator and count requests on the server (or adb logcat -s VoltraDynamicServerSched VoltraClientGlanceWidget). Expect one request per placement after the fix.
- Lingua principale
- TypeScript
- Stelle
- 850
- Fork
- 50
- Merge medio
- 15h 13m
- PR unite (30g)
- 13
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di callstackincubator/voltra
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
callstackincubator/voltra#360 ·
I maintainer di solito rispondono entro 1 giorno
-
platform:iOS
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
callstackincubator/voltra#340 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
refactor-scout
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
callstackincubator/voltra#308 ·
I maintainer di solito rispondono entro 1 giorno
-
refactor-scout
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
callstackincubator/voltra#307 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement platform:Android platform:iOS
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
callstackincubator/voltra#343 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di callstackincubator/voltra
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
microsoft/playwright#43640 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
grasshopper-protocol/grsshppr#172 ·
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Tencent/teamai-cli#1397 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
DouyinFE/semi-design#3641 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno