Skip to content
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

A Controller's task continues to execute even after being deleted. #3117

Open
joicodev opened this issue Jun 5, 2024 · 1 comment
Open
Assignees

Comments

@joicodev
Copy link

joicodev commented Jun 5, 2024

Issue Description in GetX

I have a controller named SplashController that includes a method designed to wait 10 seconds before executing a task. If I navigate to another route before the 10 seconds elapse, the log shows that the controller has been deleted (which is correct). However, the issue arises when, after the 10 seconds, the task is executed despite the controller being destroyed.

Issue Details:

Controller: SplashController
Affected Function: Method that waits 10 seconds before executing a task.
Expected Behavior: If the controller is destroyed before the 10 seconds elapse, the task should not be executed.
Observed Behavior: Despite the controller being destroyed and this being logged, the task is executed once the 10 seconds pass.

Steps to Reproduce:

Implement a controller SplashController with a method that waits 10 seconds before executing a task.
Navigate to another route before the 10 seconds elapse.
Observe the log indicating that the controller has been deleted.
Wait 10 seconds and observe that the task is executed nonetheless.

Additional Information:

The expectation is that the task should not be executed if the controller has been destroyed.
This suggests that the destruction of the controller is not properly canceling the scheduled task.
@eddyuan
Copy link

eddyuan commented Jun 27, 2024

Check for “isClosed” before executing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants