instedd / verboice

Open source toolkit for voice services; with special focus to the needs of medium- and low-income countries, scalable services, and interacting with vulnerable populations
http://verboice.instedd.org/
GNU General Public License v3.0
43 stars 18 forks source link

Garbage collector for active calls #912

Closed aeatencio closed 2 years ago

aeatencio commented 2 years ago

When a call remains active for too long Verboice considers there was an error and cancels it.

This GC runs every X minutes and cancels every active call for more than N minutes.

The value X defaults to 10 minutes and is configurable via the ENV variable minutes_between_active_calls_gc_runs.

The value N defaults to 120 minutes and is configurable via the ENV variable minutes_for_cancelling_active_calls.

For #900

Bonus track: buggy code deletion.

aeatencio commented 2 years ago

Do we know if the broker understands that a call got cancelled with respect to the channel limit? ie, will it start a new call if any one is queued?

@matiasgarciaisaia, you may be right! Thanks!!!

This is what we do in the API. Maybe we need to include queued_calls this way too, right?

I'm also thinking about the callbacks - will they trigger? My fear is that we're silently just marking calls as failed, without that affecting the behavior of the system.

No clue about how to check this. But what I think is that we're reproducing how the calls are being canceled manually, so it should work, right?

aeatencio commented 2 years ago

@matiasgarciaisaia, please let me know how you see these changes now. I know this may not be the ideal solution, but please let me know if you think it's good enough. Thanks!!

aeatencio commented 2 years ago

I think we finished with this, @matiasgarciaisaia. Waiting for the CI to finish and your approval to merge! Thanks a lot!

aeatencio commented 2 years ago

Finally, @matiasgarciaisaia, I think we're done. This is the line I added to avoid the CI crashing 🙂

aeatencio commented 2 years ago

@matiasgarciaisaia, I've just merged this, but could I ask for your approval on this PR? 🙏 Thanks!!

matiasgarciaisaia commented 2 years ago

I've reviewed the PR on Friday but forgot to comment. All is good 👍