Skip to content

Change to accept delay_sec as 0 sec#46

Open
kawasin73 wants to merge 1 commit into
Nextdoor:masterfrom
aces-inc:delay_seconds
Open

Change to accept delay_sec as 0 sec#46
kawasin73 wants to merge 1 commit into
Nextdoor:masterfrom
aces-inc:delay_seconds

Conversation

@kawasin73

Copy link
Copy Markdown

It is impossible to set 0 DelaySeconds (Execute Immediately) for SendMessage at Publisher.publish() because delay_sec or 1 is recognized as 1 when delay_sec == 0.

DelaySeconds for send_message() does not accept None but only int. It is reasonable to check delay_sec is None or not by or. But i think the fallback value should be 0.

Comment thread kale/publisher.py
sqs_queue.send_message(
MessageBody=kale_msg.encode(),
DelaySeconds=delay_sec or 1
DelaySeconds=delay_sec or 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more appropriate backwards compatible change would be to change the default value in the parameter list to delay_sec=1 and remove the delay_sec is not None check above (L35). The parameter is an int therefore None can be expected to raise a TypeError. Then change this line to DelaySeconds=delay_sec.

@MasashiFukuzawa MasashiFukuzawa deleted the delay_seconds branch October 16, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants