Skip to content

Conversation

@G81BVfaN
Copy link

@G81BVfaN G81BVfaN commented Nov 21, 2024

  • Adding the possibility to specify a TTL (Time To Live) for the lock.
  • Stop refreshing the lock's TTL, if the lock store supports expiring.

@G81BVfaN G81BVfaN mentioned this pull request Nov 21, 2024
@PabloKowalczyk
Copy link
Member

Please do rebase

@G81BVfaN G81BVfaN force-pushed the expiring_lock_stores_fix branch from be85011 to cb4e1b8 Compare November 22, 2024 09:47
@G81BVfaN
Copy link
Author

Done, but the rebase brought a lot of commits to the PR that we don't need here in the upstream 🫢

@G81BVfaN G81BVfaN force-pushed the expiring_lock_stores_fix branch from cb4e1b8 to 4004aba Compare November 22, 2024 10:42
@G81BVfaN
Copy link
Author

G81BVfaN commented Nov 22, 2024

Done, but the rebase brought a lot of commits to the PR that we don't need here in the upstream 🫢

Rookie mistake, i rebased with our fork's origin, instead of the upstream's origin 😅
Now it should be fine.

src/Event.php Outdated
* @throws CrunzException
*/
public function preventOverlapping(?object $store = null)
public function preventOverlapping(?object $store = null, ?int $ttl = 30)
Copy link
Member

Choose a reason for hiding this comment

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

Why null is allowed?

Copy link
Author

Choose a reason for hiding this comment

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

it's now back to only int.

$this->skip(function () {
$lock = $this->createLockObject();
$this->skip(function () use ($ttl) {
$lock = $this->createLockObject($ttl);
Copy link
Member

Choose a reason for hiding this comment

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

What about some tests?

Copy link
Author

@G81BVfaN G81BVfaN Jun 30, 2025

Choose a reason for hiding this comment

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

I've added a very basic test:
test_expiring_store_can_be_passed_to_prevent_overlapping_with_ttl()

@G81BVfaN G81BVfaN force-pushed the expiring_lock_stores_fix branch from e6ebec0 to 487a9c6 Compare June 30, 2025 12:57
@G81BVfaN G81BVfaN changed the base branch from 3.8 to 3.9 June 30, 2025 14:54
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