Alpha-08: Apps may not schedule more than 100 distinct jobs

旧城冷巷雨未停 提交于 2019-12-13 05:49:40

问题


I've looked around and the consensus is it's fixed on Alpha-07, but I'm seeing it in 08 on a 7.0 AND 8.0 device. I have network constraints so there is a possibility that given a long period of no network I could schedule more than 100 work items. I'm a little confused about how batching plays into this. Are we saying WorkManager can only schedule 100 items before it crashes or is there still a batching bug? Thanks

Code that adds to WM:

Constraints constraints = new Constraints.Builder()
        .setRequiredNetworkType(NetworkType.CONNECTED)
        .build();
Data inputData = new Data.Builder()
        .putString(UploadWorker.DATA, data)
        .build();
OneTimeWorkRequest uploadWork = new OneTimeWorkRequest.Builder(UploadWorker.class)
        .setConstraints(constraints)
        .setInputData(inputData)
        .setBackoffCriteria(BackoffPolicy.EXPONENTIAL, BACK_OFF_TIME_DELAY_SECONDS, TimeUnit.SECONDS)
        .addTag(TAG)
        .build();
WorkManager workManager = WorkManager.getInstance();
workManager.enqueue(uploadWork);

回答1:


There's a new version of the WorkManager library (version alpha09) that should solves this issue once for all. As reported in the release notes:

Added another fix that was needed for the "100 jobs" error. b/115560696

A good option to see how the WorkManager library is evolving is to keep an eye on its issue tracker.



来源:https://stackoverflow.com/questions/52286698/alpha-08-apps-may-not-schedule-more-than-100-distinct-jobs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!