def test_is_eligible_recently_moved( self, store: RedisRealtimeMetricsStore, monkeypatch: "pytest.MonkeyPatch" ) -> None: store._backoff_timer = 10 # Abusing the fact that removing always updates the backoff timer even if it's a noop store.remove_projects_from_lpq({17}) monkeypatch.setattr( low_priority_symbolication, "excessive_event_rate", lambda proj, counts: True ) _update_lpq_eligibility(17, 10) assert store.get_lpq_projects() == set()
def test_remove_projects_from_lpq_backing_off_reremoving( store: RedisRealtimeMetricsStore, redis_cluster: redis._RedisCluster) -> None: redis_cluster.set(f"{store._backoff_key_prefix()}:1", 1) removed = store.remove_projects_from_lpq({1}) assert not removed
def test_remove_projects_from_lpq_unset( store: RedisRealtimeMetricsStore, redis_cluster: redis._RedisCluster) -> None: removed = store.remove_projects_from_lpq({1}) assert removed == 0 remaining = redis_cluster.smembers("store.symbolicate-event-lpq-selected") assert remaining == set()
def test_remove_projects_from_lpq_backing_off_removing( store: RedisRealtimeMetricsStore, redis_cluster: redis._RedisCluster) -> None: store.add_project_to_lpq(1) in_lpq = redis_cluster.smembers("store.symbolicate-event-lpq-selected") assert in_lpq == {"1"} assert redis_cluster.get(f"{store._backoff_key_prefix()}:1") == "1" removed = store.remove_projects_from_lpq({1}) assert not removed