slackapi / slackapi/bolt-python
Lazy listeners do not work with Chalice local testing server
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 1.3k
- Fork
- 288
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 10
Mô tả
I want to perform operations when a member has joined a channel which takes more than 5 seconds, but I'm getting BrokenPipeError: [Errno 32] Broken pipe.
The minimal step to reproduce the same has been shown below while using the lazy listener it waits for 10 seconds before responding back.
Reproducible in:
from chalice import Chalice, Response
from slack_bolt import App
from slack_bolt.adapter.aws_lambda.chalice_handler import ChaliceSlackRequestHandler
bolt_app = App(process_before_response=True)
app = Chalice(app_name='chalice_app_name')
slack_handler = ChaliceSlackRequestHandler(app=bolt_app, chalice=app)
@bolt_app.event("message")
def handle_message_events(body, logger):
logger.info(body['event']['text'])
def respond_to_slack_within_3_seconds(ack):
ack("Accepted!")
def say_it(say):
time.sleep(10)
say("Done!")
bolt_app.event("member_joined_channel")(
ack=respond_to_slack_within_3_seconds, lazy=[say_it]
)
@app.route(
"/slack/events",
methods=["POST"],
content_types=["application/x-www-form-urlencoded", "application/json"],
)
def events() -> Response:
return slack_handler.handle(app.current_request)
The slack_bolt version
slack-bolt==1.9.1
slack-sdk==3.11.1
Python runtime version
Python 3.6.15
OS info
Ubuntu 20.04.3 LTS
Steps to reproduce:
- While handling of any Slack event (e.g. handle_member_joined event)
- Use lazy listener and wait for more than 3 seconds before responding back to Slack
Expected result:
Since the event is acknowledging the Slack within 3 seconds irrespective of the lazy listener function time, it should have processed the same.
Actual result:


Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu từ entry point ChaliceSlackRequestHandler và tái hiện sự kiện member_joined_channel với process_before_response được bật cùng một lazy listener ngủ trong 10 giây. Kiểm tra hành vi của máy chủ kiểm thử cục bộ xung quanh phản hồi /slack/events và xác nhận rằng lazy listener hoàn tất mà không gặp BrokenPipeError sau khi acknowledgement được gửi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, python
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100