leandromoreira / redlock-rb

Redlock is a redis-based distributed lock implementation in Ruby. More than 20M downloads.
BSD 2-Clause "Simplified" License
690 stars 80 forks source link

Include the error messages when we fail due to too many errors. #147

Closed Metallion closed 1 year ago

Metallion commented 1 year ago

I found the "Too many Redis errors prevented lock acquisition" to be a little unhelpful. If we'd see this in an error tracking system, we'd still have to guess what the errors were.

The error object does come with an array containing all the original errors but I thought it'd make things a lot easier if we'd also include them in the error message. Otherwise I'd end up having to rescue the LockAcquisitionError on every call just to inspect and report the original errors.

With this change we can just call the lock method as is and error tracking systems will get a helpful message telling us exactly what happened.

dwightwatson commented 1 year ago

I've noticed since upgrading to Redlock 2 I'm getting this error a heap (curious why I didn't get it on Redlock 1, I wonder if it was previously failing silently). Would definitely be more helpful to have the underlying messages available in error tracking.

leandromoreira commented 1 year ago

Thanks @Metallion https://github.com/leandromoreira/redlock-rb/releases/tag/2.0.6 🚀