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

[8.x] Rename some queue configurations #32728

Merged
merged 9 commits into from
May 11, 2020
Merged

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented May 8, 2020

This PR does the following:

  1. Deprecates the --delay option of the queue:workcommand.
  2. Adds a --backoff option to the command to replace --delay.
  3. Renames $retryAfter and retryAfter() to $backoff and backoff() on jobs, mailers, notifications, and listeners.
  4. Changes $timeoutAt in jobs, notifications, and listeners to $retryUntil to match the name of the alternative retryUntil() method and not conflict with the $timeout property.

Marked as draft as I'm going to check there are no other confusing configurations on Monday. Just wanted to make it public for feedback.

@themsaid themsaid marked this pull request as draft May 8, 2020 21:10
@clarkeash
Copy link
Contributor

clarkeash commented May 8, 2020

  • I think —delay is clearer than —backoff.
  • I think ”The number of seconds before a released job will be available” Is better as the command description.
  • if —delay is kept then I would keep retryAfter or rename to delayUntil

@trevorgehman
Copy link
Contributor

  • --delay is pretty bad and needs to be changed, but not sure that --backoff is much better.
  • I agree with @clarkeash. Your command description update is a great improvement.

What if instead of backoff we'd do one of these:

Option 1:

  • --retry-after
  • $retryAfter/retryAfter()
  • $retryUntil/retryUntil()

Option 2:

  • --retry-delay
  • $retryDelay/retryDelay()
  • $retryUntil/retryUntil()

I know the issue with retryAfter() is that the config option for the queue connections includes a retry_after key, but it seems like that needs to be renamed to something like release_after.

@michaeldyrynda
Copy link
Contributor

Instead of immediately renaming the methods, would you be open to adding the new methods, calling the methods they’re replacing internally, and marking the old methods @deprecated, then removing them in Laravel 9?

I know a major version allows for breaking changes, but deprecating them gives developers a more gradual ramp to update their code.

Alternatively, doing it this way would even allow you to introduce the new methods in a minor release in 7.x, add the deprecation notice, and remove in 8.0 if you really wanted to target that release. It’s only a ~3 month window from deprecation to removal, though.

@izshreyansh
Copy link

I think terminate is better explanation than backoff.

@shadoWalker89
Copy link
Contributor

agree with @trevorgehman backoff is not a good replacement
agree with @michaeldyrynda it's better to deprecate it and remove it in a later version, and since there is no much time until 8.x maybe deprecate it in 7.x and remove it in 9.x

@themsaid
Copy link
Member Author

Hey everyone,

backoff appears to be the closest-to-right term to use after researching the topic. We can't use retry-after because it's used in config/queue.php to imply a different thing.

We also don't want to use retry-delay because we want to keep the term "delay" used only for pushing jobs to be queued later.

As for deprecation notices. I think the change can be done via find-and-replace in your code editor so it won't make the upgrade too much difficult. So imo I think we can go ahead and rename the method/properties in 8.x

@michaeldyrynda
Copy link
Contributor

As for deprecation notices. I think the change can be done via find-and-replace in your code editor so it won't make the upgrade too much difficult. So imo I think we can go ahead and rename the method/properties in 8.x

I think most changes can be some via find and replace, I don’t dispute that. It’s about deprecating methods more thoughtfully, and providing some notice - outside of a PR that not everybody is going to see - to give people a chance to deal with the deprecation.

@taylorotwell taylorotwell merged commit da5ba6f into laravel:master May 11, 2020
*
* @var int
*/
public $retryAfter;
public $backoff;
Copy link
Member

Choose a reason for hiding this comment

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

Others have already commented about the nomenclature of backoff here.

I just want to add that backoff has a certain connotation of gradually backing off, so that each time it fails the delay is increased 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello 👋🏼

I know no one asked for my opinion here, but what triggered me writing this comment is that, now that I was faced with the delay/backoff rename in a project and researched how this came about, I was under the same impression and thought "this doesn't feel right". As you said: "gradually backing off" was also my expectation

But, IMHO, turns out we're mostly just so used to the (indeed very common place) e.g. "exponential backoff" that it's easy to assume (even myself) the "backoff" equals "exponential backoff".

But in fact there are just different types of backoff one can do:

  • linear
  • constant
  • exponential

My 2c FWIW 😄

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.

9 participants