(account)
| 45 | account.save(update_fields=['active_streams']) |
| 46 | |
| 47 | def decrement_stream_count(account): |
| 48 | with lock: |
| 49 | current_usage = active_streams_map.get(account.id, 0) |
| 50 | if current_usage > 0: |
| 51 | current_usage -= 1 |
| 52 | if current_usage == 0: |
| 53 | del active_streams_map[account.id] |
| 54 | else: |
| 55 | active_streams_map[account.id] = current_usage |
| 56 | account.active_streams = current_usage |
| 57 | account.save(update_fields=['active_streams']) |
| 58 | |
| 59 | |
| 60 | def calculate_tuner_count(minimum=1, unlimited_default=10): |