Skip to content
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

feat: maxRetryDelay option to limit retryBackoff #531

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

danilofuchs
Copy link
Contributor

Closes #520

Implements a new flag in new PgBoss(), queue and job

This flag limits the exponential backoff to the desired delay, in seconds.

I decided to only apply its value if retryBackoff is true.

Alternatives:

  1. Rename new parameter to maxRetryBackoffDelay
  2. maxRetryDelay should also limit retryDelay, but that seems redundant

Observations:

  1. It is possible to unset this value in updateQueue, with an undefined parameter (maybe use explicit null in this case?)

expire_seconds = COALESCE($6, expire_seconds),
retention_minutes = COALESCE($7, retention_minutes),
dead_letter = COALESCE($8, dead_letter),
max_retry_delay = $6,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was necessary not to use COALESCE because the user may want to set it to null explicitly

ELSE now() + (
ELSE now() +
LEAST(
(
retry_delay * 2 ^ LEAST(16, retry_count + 1) / 2 +
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This 16 limit is not documented, perhaps it should be removed in favour of max_retry_delay in the future?

CASE
WHEN COALESCE(j.retry_backoff, q.retry_backoff, retry_backoff_default, false)
THEN COALESCE(j.max_retry_delay, q.max_retry_delay, max_retry_delay_default)
ELSE NULL
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When retry_backoff is not true, we force the max delay to NULL

@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling f05cbdc on danilofuchs:feat/max-retry-delay
into 57b74cc on timgit:master.

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.

Feature request: maxRetryDelay
2 participants