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

Allow custom mutex names for isolated commands #2

Open
wants to merge 4 commits into
base: 10.x
Choose a base branch
from

Conversation

rybakihor
Copy link
Collaborator

@rybakihor rybakihor commented Jul 13, 2023

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 the getIsolatedMutexName 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 the getIsolatedMutexName 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.

…he commandMutexName function in the CacheCommandMutex class
@rybakihor rybakihor changed the title Allowing custom mutex names for isolated commands Allow custom mutex names for isolated commands Jul 13, 2023
# Conflicts:
#	tests/Console/CacheCommandMutexTest.php
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.

1 participant