sohailshk opened a new pull request, #76961: URL: https://github.com/apache/airflow/pull/76961
`S3KeysUnchangedTrigger` hardcoded `self.polling_period_seconds = 0` (since "Add deferrable mode to S3KeysUnchangedSensor", #31940) and `S3KeysUnchangedSensor` never passed its `poke_interval` to the trigger, so a deferred sensor listed the bucket in a loop with `asyncio.sleep(0)` between checks. `S3KeyTrigger` receives `poke_interval` from `S3KeySensor`; this trigger did not. With a mocked `is_keys_unchanged_async` the trigger made 51,795 checks in one second on main and 1 with this change; against S3 each check is a ListObjectsV2 request. The trigger now takes `polling_period_seconds` (default 60, the sensor's default `poke_interval`) and the sensor passes `polling_period_seconds=self.poke_interval`. The key was already part of `serialize()`; its value changes from the hardcoded `0` to the configured one (60 by default). Triggers that an older provider version already deferred carry `polling_period_seconds=0` and keep looping until they fire or are cleared. Tests: `test_run_waits_between_checks` (trigger sleeps for the configured period between a pending and a success result), `test_execute_passes_poke_interval_to_trigger` (sensor passes `poke_interval` to the trigger) and the updated serialization test fail on main and pass here: `triggers/test_s3.py` and `sensors/test_s3.py` 47 passed. I did not run it against real S3 or a real triggerer. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) The implementation and tests were written with AI assistance. Generated-by: AI coding assistant following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
