natspy-lock
is a distributed lock library using nats.
Table of Contents
pip install natspy-lock
import nats
from natspy_lock import NatsLock
async def main():
nc = await nats.connect("nats://127.0.0.1:4222")
await NatsLock.init(nc, "test_lock", 60)
async with NatsLock.get_lock("test_lock", 1):
# do something
pass
await nc.drain()
natspy-lock
is distributed under the terms of the MIT license.