-1

Ok so more to the point:

I’m creating calls. These calls while they are active, they keep a record in a table. I have no knowledge in my script of the calls status but by counting the records in that table. The calls last whatever they last.

I get a number list that I need to call.

I just start a for NUMBER and start sending calls, these calls are sent via a simple function that “shoot and forget”, so the function returns immediately.

I check the call count from the db table and whenever the call count is lower than maxChannels, I send more calls.

I’m not looking for specific code, I’m asking whether this can be done via some module in python. The script is working, that’s not a problem, I’m just wondering and looking to make it better, maybe by using some module out there.

David Villasmil
  • 395
  • 2
  • 19

1 Answers1

0

Maybe it's a bad design but since you mentioned it's difficult to explain we pass from it and think that it should be what it is! So you have count and max records. Some scenarios can achieve your goals to grab the new count of max records. My main idea is you would change the max records by a function call. So... I would recommend you to save count with caching mechanism or Redis. These are the things that depend on the frequency of the needs of count or max records changes.

1- calling function to change count after any changes to records ( any function that can)

2- whenever you need count call it from DB or the table.

3- doing it as a worker with something like celery.