jamesisaac / react-native-background-task

Periodic background tasks for React Native apps, cross-platform (iOS and Android), which run even when the app is closed.
MIT License
1.1k stars 110 forks source link

Android: default timeout is set to 30ms instead of 30s #24

Open wodCZ opened 6 years ago

wodCZ commented 6 years ago

As per Headless JS documentation, timeout should be provided as a number of miliseconds.

In default configuration, this library sets 30 as timeout parameter, which means 30ms.

Relevant source code lines: index.android.js and RNJob.java.

This typo is very difficult to notice, as it's only visible in logcat: 01-31 16:22:07.293 9869-9869/com.my.app D/BackgroundTask: Returning HeadlessJsTaskConfig, timeout=30 ms

This could be overriden by timeout property in schedule method (setting that to 30000). I'm not sure it this wouldn't break iOS implementation though.

wodCZ commented 6 years ago

Oops, my mistake, timeout is actually correctly converted to milliseconds, only the log message has typo & shows ms instead of s.

Closing this as it's not worth of an issue, sorry.

jamesisaac commented 6 years ago

No worries, thanks for reporting and the follow up! I'll actually reopen this to remind myself to correct the log message.

vitto-moz commented 6 years ago

logs still have 'ms'