Browse Source

remove ErrShouldRetry

pull/117/head
yedf2 4 years ago
parent
commit
6d7872fa5a
  1. 3
      dtmsvr/storage/boltdb.go
  2. 1
      dtmsvr/storage/store.go

3
dtmsvr/storage/boltdb.go

@ -358,6 +358,7 @@ func (s *BoltdbStore) LockOneGlobalTrans(expireIn time.Duration) *TransGlobalSto
next := time.Now().Add(time.Duration(config.RetryInterval) * time.Second) next := time.Now().Add(time.Duration(config.RetryInterval) * time.Second)
err := boltGet().Update(func(t *bolt.Tx) error { err := boltGet().Update(func(t *bolt.Tx) error {
cursor := t.Bucket(bucketIndex).Cursor() cursor := t.Bucket(bucketIndex).Cursor()
for trans == nil {
k, v := cursor.First() k, v := cursor.First()
if k == nil || string(k) > min { if k == nil || string(k) > min {
return ErrNotFound return ErrNotFound
@ -365,8 +366,6 @@ func (s *BoltdbStore) LockOneGlobalTrans(expireIn time.Duration) *TransGlobalSto
trans = tGetGlobal(t, string(v)) trans = tGetGlobal(t, string(v))
err := t.Bucket(bucketIndex).Delete(k) err := t.Bucket(bucketIndex).Delete(k)
dtmimp.E2P(err) dtmimp.E2P(err)
if trans == nil { // index exists, but global trans not exists, so retry to get next
return ErrShouldRetry
} }
trans.NextCronTime = &next trans.NextCronTime = &next
tPutGlobal(t, trans) tPutGlobal(t, trans)

1
dtmsvr/storage/store.go

@ -10,7 +10,6 @@ import (
) )
var ErrNotFound = errors.New("storage: NotFound") var ErrNotFound = errors.New("storage: NotFound")
var ErrShouldRetry = errors.New("storage: ShoudRetry")
var ErrUniqueConflict = errors.New("storage: UniqueKeyConflict") var ErrUniqueConflict = errors.New("storage: UniqueKeyConflict")
type Store interface { type Store interface {

Loading…
Cancel
Save