-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BackgroundService.start is create multiple task #121
Comments
@shinnachot, I am not sure, but you may need to resolve your promise: await new Promise(async (resolve) => {
// For loop with a delay
const { delay } = taskData;
for (let i = 0; BackgroundService.isRunning(); i++) {
console.log('Send data');
await BackgroundService.updateNotification({ taskDesc: 'Tracking...' + i });
await sleep(delay);
}
resolve();
}); |
+1 |
@Rapsssito i modified the pkg code locally and when i adjust the onStartCommand like this it works.
Dont know if this solves the problem, but worked for me |
@fabiros, could you create a PR with your code so we can have this "fix" in a branch at least? |
@Rapsssito done |
This issue should be fixed by #124. Feel free to reopen if the problem persists. |
Does any one found the solution for this? |
we're facing this issue as well, we're solving it with an MMKV flag for now, edit:
|
I using this code when i want to start some task
BackgroundService.start(this.taskRandom, options);
When i kill app or logout i use this code to stop task
BackgroundService.stop();
It's work fine but...when i try to start task again
BackgroundService.start(this.taskRandom, options);
it'll do a multiple task jobExample
start task 1 13:05PM
stop
start task 1 13:10PM
start task 1 13:15PM
<<< it will double do job like this forever
Here is my code
The text was updated successfully, but these errors were encountered: