-
Notifications
You must be signed in to change notification settings - Fork 276
feat: surface ack_timeout on the handler #1351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
slack_bolt/app/app.py
Outdated
| matchers: Optional[Sequence[Callable[..., bool]]] = None, | ||
| middleware: Optional[Sequence[Union[Callable, Middleware]]] = None, | ||
| auto_acknowledge: bool = True, | ||
| acknowledgement_timeout: int = 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we name this ack_timeout rather then acknowledgement_timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: ack_timeout makes sense to me and matches the ack parameter well! 📚 ✨
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1351 +/- ##
==========================================
- Coverage 90.96% 90.96% -0.01%
==========================================
Files 222 222
Lines 7507 7517 +10
==========================================
+ Hits 6829 6838 +9
- Misses 678 679 +1 ☔ View full report in Codecov by Sentry. |
zimeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WilliamBergamin LGTM! Awaited ack seems so good for tasks needing time 👾 ✨
I left a few comments of thoughts and idea but nothing blocking. Your suggestion of ack_timeout is solid IMHO 👀
slack_bolt/app/app.py
Outdated
| matchers: Optional[Sequence[Callable[..., bool]]] = None, | ||
| middleware: Optional[Sequence[Union[Callable, Middleware]]] = None, | ||
| auto_acknowledge: bool = True, | ||
| acknowledgement_timeout: int = 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: ack_timeout makes sense to me and matches the ack parameter well! 📚 ✨
| assert ( | ||
| f'WARNING On @app.function("{callback_id}"), as `auto_acknowledge` is `True`, `{timeout_argument_name}={kwargs[timeout_argument_name]}` you gave will be unused' | ||
| in caplog.text | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quibble: Hardcoding the expected outputs might make this output more immediate at a glance! I'm not so familiar with kwargs I must admit 😔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used kwargs in the test in order to assert that the parameter name shown in the warning is the one defined by the function 🤔 I think we should leave it for now but we don't need to make this a common pattern
zimeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WilliamBergamin LGTM and I'm so optimistic in the change to match ack around- 👾 ✨
Summary
These changes aim to surface
ack_timeoutat the function handler level. This allows developers to set their own custom timeout for the acknowledgement, this comes in handler when dealing with dynamic options or new function types that may allow for a timeout greater then 3 secondsTesting
Set up an app with the following function handler
Bolt will allow your handler to take up to 5 seconds before returning an error response to Slack
Configuring the handler with
auto_acknowledge=true(default behavior)Will print a warning indicating that
ack_timeouthas no effectFeedback
Instead of naming this
acknowledgement_timeoutshould e name itack_timeout? 🟢Category
slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.