mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 23:20:26 +08:00
简化数据库查询代码
This commit is contained in:
@@ -50,7 +50,7 @@ func (this *SysLockerDAO) Lock(key string, timeout int64) (bool, error) {
|
||||
op.Key = key
|
||||
op.TimeoutAt = time.Now().Unix() + timeout
|
||||
op.Version = 1
|
||||
_, err := this.Save(op)
|
||||
err := this.Save(op)
|
||||
if err != nil {
|
||||
maxErrors--
|
||||
if maxErrors < 0 {
|
||||
@@ -73,7 +73,7 @@ func (this *SysLockerDAO) Lock(key string, timeout int64) (bool, error) {
|
||||
op.Id = locker.Id
|
||||
op.Version = locker.Version + 1
|
||||
op.TimeoutAt = time.Now().Unix() + timeout
|
||||
_, err = this.Save(op)
|
||||
err = this.Save(op)
|
||||
if err != nil {
|
||||
maxErrors--
|
||||
if maxErrors < 0 {
|
||||
|
||||
Reference in New Issue
Block a user