SimonErm/react-native-job-queue

Passing function to payload as parameter.

leonamjlpaula opened this issue · 5 comments

I'm trying to pass a function to be executed inside job but the payload seems to be excluding it. This function is used to update a process progress bar and need to be imported inside a component because it comes from a useContext.
Would be possible to fix this?

Hello Leon,
you can't pass a function as payload since the payload is stored as JSON and functions don't get (can't be) serialized.
But i am not sure if i got your problem right, maybe you can provide some example code.

Thats exactly what I need to know. I was expecting this kind of behaviour. Meanwhile I created a workaround using AsyncStorage. Thanks a lot for your help.

@SimonErm i'd like to ask if you know background tasks, like the ones provided by this lib, have some kind of malfunction/lags/memory exception when executed on Android Go. I have users complaining about my tasks and the only thing I can think now, after debugging a lot, is this OS.

No sorry, it's the first time i hear about Android Go. I now read a summary about it and if i get it right, it's used by low spec devices with 2GB or less RAM. So maybe your app is doing some memory heavy tasks that causes the lags on this devices?
Can you provide some logs of the exceptions?

I close this because of inactivity