From 0e9386fd7daaef76326f78527819982273ec2a86 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Thu, 23 Jan 2025 16:19:41 -0500 Subject: [PATCH] Formatting file --- corehq/project_limits/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/corehq/project_limits/models.py b/corehq/project_limits/models.py index 6b7104e0f5f0..ad7813ebbf78 100644 --- a/corehq/project_limits/models.py +++ b/corehq/project_limits/models.py @@ -1,6 +1,5 @@ -from django.db import models - import architect +from django.db import models AVG = 'AVG' MAX = 'MAX' @@ -29,6 +28,7 @@ def delete(self, *args, **kwargs): def _clear_caches(self): from corehq.project_limits.rate_limiter import get_dynamic_rate_definition + get_dynamic_rate_definition.clear(self.key, {}) @@ -37,6 +37,7 @@ class GaugeDefinition(models.Model): An abstract model to be used to define configuration to limit gauge values. The model is used by GaugeLimiter class to decide weather to limit or not. """ + key = models.CharField(max_length=512, blank=False, null=False, unique=True, db_index=True) wait_for_seconds = models.IntegerField(null=False) acceptable_value = models.FloatField(default=None, blank=True, null=True) @@ -59,12 +60,12 @@ def _clear_caches(self): class PillowLagGaugeDefinition(GaugeDefinition): - max_value = models.FloatField(default=None, blank=True, null=True) average_value = models.FloatField(default=None, blank=True, null=True) def _clear_caches(self): from corehq.project_limits.gauge import get_pillow_throttle_definition + get_pillow_throttle_definition.clear(self.key)