Browse Source

remove ErrShouldRetry

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

17
dtmsvr/storage/boltdb.go

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

1
dtmsvr/storage/store.go

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

Loading…
Cancel
Save