gocraft / work

Process background jobs in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Semaphore locks can't release

xuannv112 opened this issue · comments

commented

https://github.com/gocraft/work/blob/master/redis.go#L109

Take a look at how the LUA script increases the lock key. I think we should apply another mechanism for semaphore lock. It is unsafe for the current mechanism, somehow the release lock step can't be executed (https://github.com/gocraft/work/blob/master/worker.go#L267) due to connections to Redis.

In general, it should have an expired time when using the lock key.
https://redis.com/ebook/part-2-core-concepts/chapter-6-application-components-in-redis/6-3-counting-semaphores/