예제 #1
0
    def test_user_rates(self):
        from sentry import tsdb

        metrics.incr("groupsnooze.test_user_rates")

        end = timezone.now()
        start = end - timedelta(minutes=self.user_window)

        rate = tsdb.get_distinct_counts_totals(
            model=tsdb.models.users_affected_by_group, keys=[self.group_id], start=start, end=end
        )[self.group_id]

        if rate >= self.user_count:
            return False

        return True
예제 #2
0
    def test_user_rates(self):
        from sentry import tsdb

        end = timezone.now()
        start = end - timedelta(minutes=self.user_window)

        rate = tsdb.get_distinct_counts_totals(
            model=tsdb.models.users_affected_by_group,
            keys=[self.group_id],
            start=start,
            end=end,
        )[self.group_id]

        if rate >= self.user_count:
            return False

        return True