pabloem commented on code in PR #39538:
URL: https://github.com/apache/beam/pull/39538#discussion_r3685168864
##########
.test-infra/tools/stale_cleaner.py:
##########
@@ -331,18 +331,19 @@ def __init__(self, project_id: str, bucket_name: str,
def _active_resources(self) -> dict:
d = {}
self.client = pubsub_v1.SubscriberClient()
+ taxi_prefix =
f"{self.project_path}/subscriptions/taxirides-realtime_beam_"
Review Comment:
why are you adding the taxi prefix here? the taxi prefix should be included
in `self.prefixes`, so it doesn't make sense to re-check it.
##########
.test-infra/tools/stale_cleaner.py:
##########
@@ -331,18 +331,19 @@ def __init__(self, project_id: str, bucket_name: str,
def _active_resources(self) -> dict:
d = {}
self.client = pubsub_v1.SubscriberClient()
+ taxi_prefix =
f"{self.project_path}/subscriptions/taxirides-realtime_beam_"
with self.client:
for subscription in
self.client.list_subscriptions(request={"project": self.project_path}):
subscription_name = subscription.name
# Apply prefix filtering if prefixes are defined
- if not self.prefixes or
any(subscription_name.startswith(f"{self.project_path}/subscriptions/{prefix}")
for prefix in self.prefixes):
- # Safe orphan detection:
- # - Standard rule: detached subscriptions are eligible.
- # - Taxi exception: subscriptions containing the NYC taxi
prefix are eligible even if attached.
- es_taxi = "taxirides-realtime_beam_" in subscription_name
- if subscription.detached or es_taxi:
+ if subscription.detached:
d[subscription_name] =
GoogleCloudResource(resource_name=subscription_name, clock=self.clock)
+ #Only attached subscriptions with the NYC taxi prefix are
eligible.
+ elif any(
+
subscription_name.startswith(f"{self.project_path}/subscriptions/{prefix}") for
prefix in self.prefixes
+ ) and subscription_name.startswith(taxi_prefix):
+ d[subscription_name] =
GoogleCloudResource(resource_name=subscription_name, clock=self.clock)
Review Comment:
why do we check self.prefixes AND taxi_prefix? do you see how that does not
make sense?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]