java - React-Native 超时(Android)中的无头任务
问题描述
我在 RN android 中使用无头任务,但我不明白一件事,超时,这是否意味着我希望后台进程工作多长时间?我想一直工作到调用 stopService,所以我必须在那里指定超时吗?
return new HeadlessJsTaskConfig("headless_task", data, 5000, // timeout for the task
true // optional: defines whether or not the task is allowed in foreground. Default
// is false
);
解决方案
是的。超时是该任务将处于活动状态的时间。最长为 10 分钟。如果是定期任务,则最小间隔为 15 分钟。所以有一个强制性的 5 分钟停机时间。只需在第一个任务的停机时间内启动另一个任务,并让它接管该过程。
推荐阅读
- phone-number - 如何根据 E.164 分析法国电话号码
- multithreading - 从 VPS 脚本测试“300 个线程”,可以吗?如何?
- html - 如何使用 puppeteer 连接到 websocket 并在该 websocket 上执行自动化
- python - 纯 Python 字典到列表
- python - 从数据集中训练词嵌入时不提供梯度
- cassandra - Cassandra 脚本将日期更改为即时类型
- eclipse - 包 org.junit 不存在 Junit 5
- mysql - MySQL - 过程中的基本准备语句执行问题
- python - 如何在 ModelAdmin.formfield_for_manytomany() 中使用 Django QuerySet.union()?
- spring-boot - 更新缓存记录时@Cacheable 的工作原理