diff --git a/mongodb_storage.go b/mongodb_storage.go index 922ae83..514af69 100644 --- a/mongodb_storage.go +++ b/mongodb_storage.go @@ -84,10 +84,8 @@ func (x *MongoStorage) UpdateWithVersion(ctx context.Context, lockId string, exc "_id": bson.M{ "$eq": lockId, }, - "owner_id": bson.M{ - "$eq": lockInformation.OwnerId, - }, "version": bson.M{ + //"$eq": json.Number(strconv.FormatUint(uint64(exceptedVersion), 10)), "$eq": exceptedVersion, }, } @@ -185,7 +183,9 @@ func (x *MongoStorage) Get(ctx context.Context, lockId string) (string, error) { func (x *MongoStorage) GetTime(ctx context.Context) (time.Time, error) { // MongoDB没找到好的办法拿数据库实例的时间,这里就使用一个公共的NTP作为时间源吧 + // TODO return x.timeProvider.GetTime(ctx) + //return time.Now(), nil } func (x *MongoStorage) Close(ctx context.Context) error { diff --git a/mongodb_storage_test.go b/mongodb_storage_test.go index ec1431e..c04480b 100644 --- a/mongodb_storage_test.go +++ b/mongodb_storage_test.go @@ -8,7 +8,7 @@ import ( "testing" ) -func TestNewMongoStorage(t *testing.T) { +func TestMongoStorage(t *testing.T) { envName := "STORAGE_LOCK_MONGO_URI" uri := os.Getenv(envName) assert.NotEmpty(t, uri)