简体   繁体   English

React-Native 超时(Android)中的无头任务

[英]Headless tasks in React-Native timeout (Android)

I am using headless tasks in RN android but I dont understand one thing, Timeout, does it mean how long I want the background process to work?我在 RN android 中使用无头任务,但我不明白一件事,超时,这是否意味着我希望后台进程工作多长时间? I would like to work until I call stopService so do I have to specify the timeout there at all?我想一直工作到我调用 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
    );

Yes.是的。 The timeout is how long that task will be active.超时是该任务将处于活动状态的时间。 The maximum is 10 minutes.最长为 10 分钟。 If it's a periodic task the minimum interval is 15 minutes.如果是周期性任务,则最小间隔为 15 分钟。 So there is a mandatory 5 minute down time.所以有一个强制性的 5 分钟停机时间。 Just spin up another task during the down-time of the first task, and have it take over the process.只需在第一个任务的停机时间内启动另一个任务,并让它接管整个过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM