square / mongo-lock

Distributed locking with MongoDB.
Apache License 2.0
80 stars 20 forks source link

exclusive lock can aquires lock on expired request #2

Closed PraveenKumarMahto closed 5 years ago

PraveenKumarMahto commented 5 years ago

Exclusive lock should check expiresAt in case of TTL is expired.

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 21


Totals Coverage Status
Change from base Build 17: 0.04%
Covered Lines: 482
Relevant Lines: 510

💛 - Coveralls
michaelfinch commented 5 years ago

Mind adding a test for this? Specifically to check that XLock succeeds when exclusive.acquired=true and exclusive.expiresAt <= currentTime?

PraveenKumarMahto commented 5 years ago

Mind adding a test for this? Specifically to check that XLock succeeds when exclusive.acquired=true and exclusive.expiresAt <= currentTime?

Added TestCase for the same.

michaelfinch commented 5 years ago

Thank you!

By the way, you can run the Purger on a regular interval to clean up expired locks.