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 necessity of a dispose method #4

Open
fufylev opened this issue Aug 16, 2022 · 1 comment
Open

a necessity of a dispose method #4

fufylev opened this issue Aug 16, 2022 · 1 comment

Comments

@fufylev
Copy link

fufylev commented Aug 16, 2022

Hello, @alphamikle!

After studying for a while of your lib's code one thought crossed my mind: if there any opportunity to organize a method like

@override
dispose() {
   // TODO 
   // kill any process
}

inside which I would have a possibility to kill any processes I've already run inside my Backend class (which instantiated from your Backend class), and this method would be run upon my Backend class had disposed/dismounted.

Justification: lets assume I use a Backend to do some expensive operations upon every event's tick from Web Sockets and it occur from 1 to 100 times per second while I need to have an accumulated result once per 250 ms and therefore I have to use a throttling method to reduce the number of operations to 4 per second in order not to overload my Frontend class which most definitely works on the app's main isolate. For that I use a package throttling which requires a dispose method to close/kill the timer for the purpose not to leak a RAM. This in turn would unload main isolate and made our life much easier and our apps more performant.

With this in mind, could your please give me any clue on how to implement this by existing means of your lib or, if it is possible, to upgrade your quite a sophisticated lib in order to have such an instrument?

Thanks in advance.

@Mihai-B
Copy link

Mihai-B commented Jul 17, 2023

If you are using the throtling on the beckend side, when the beckend closes, everything closes, even the "timer" set for the throttle. It is like a force close basically of everything that is running in that backend(isolate)

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

2 participants