Closed motorina0 closed 5 months ago
Oh nice. The change looks very interesting, it might fix a bug we (https://tipcards.io) are experiencing with our currently installed version of the withdraw extension (v0.1.5).
When will v0.1.8 be available for installation in LNbits? (https://raw.githubusercontent.com/lnbits/lnbits-extensions/main/extensions.json)
Summary
Make sure that increment is called sync for the same withdraw link.
The checking logic has been extracted to
_check_withdraw_link
. The_check_withdraw_link_safe
function makes sure that for one particular withdraw link the check&increment is not atomic.The
NamedLock
class holds a dictionary ofCounterLocks
. When there is now waiter for a lock then the entry is removed from the dictionary.Note:
Lock.acquire()
. It can lead to a deadlock.