Skip to content

How to prevent retry of message event when matcher returned False? #1249

@yanghua-ola

Description

@yanghua-ola

My message event handler was configured with a few matchers message_processors.

app.message(jane_message, message_processors)(handle_command)

When one of the matcher return False, the event would be considered unhandled.

INFO:slack_bolt.AsyncApp:Unsuccessful Bolt execution result (status: 404, body: {"error": "unhandled request"})

As a result, the message would be delivered a few more times with retry_reason as timeout.

DEBUG:slack_bolt.AsyncApp:Received message (type: TEXT, data: {"envelope_id":"5e7b873f-8260-499a-94ce-64c877e95df8","payload": ***, "type":"events_api","accepts_response_payload":false,"retry_attempt":3,"retry_reason":"timeout"}, extra: , session: s_8744028994636)

In my case, this resulted error messages being emitted multiple times by one of the matchers.

Image

My desired behavior is one error message for one rejected message, what's the correct way to achieve that?

Reproducible in:

The slack_bolt version

slack_bolt==1.20.0

Python runtime version

Python 3.10.12

OS info

#80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023

Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., setup.py))

  1. Setup a message handler with one matcher that emits a message say("foo") and returns False
  2. Trigger the handler by sending a message in the appropriate channel
  3. The bot would send multiple foo messages to the channel.

Expected result:

One error message for one rejected message (Matcher returned false)

Actual result:

Error messages being sent repetitively for one rejected message due to retry logic.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions