Allow custom mutex names for isolated commands #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title: Allowing custom mutex names for isolated commands
Description:
This pull request introduces a modification to the
commandMutexName
function in order to support custom mutex names for isolated commands in Laravel's framework. Previously, all commands with the same name were being blocked simultaneously, regardless of their parameters. With this update, isolated commands can define their own identifier using thegetIsolatedMutexName
method.Changes Made:
Updated the
commandMutexName
function in the framework directory to include the command's isolated mutex name, if provided.Added a conditional check using
method_exists
to determine if thegetIsolatedMutexName
method is available for the command.If the
getIsolatedMutexName
method exists, the isolated mutex name is appended to the base name of the command's mutex.If the
getIsolatedMutexName
method is not present, the base name of the command's mutex is returned as before.This modification enables more granular control over command execution, allowing isolated commands to have unique mutex names even if they share the same command name. This is especially useful when we want to block the simultaneous execution of a command with the same parameters, but not to block the execution of this command with other parameters.