Skip to content

Commit

Permalink
fix: some fixes in manipvortex (#90)
Browse files Browse the repository at this point in the history
* fix: manivortex
  • Loading branch information
sibicramesh authored Jul 23, 2019
1 parent c99619b commit 2a9a3c7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions manipvortex/manipulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func (m *vortexManipulator) backgroundSync(ctx context.Context) {
}

retryCtx, cancel := context.WithDeadline(ctx, t.Deadline)
cancel()
defer cancel()

if err := m.commitUpstream(retryCtx, t.Method, t.mctx, t.Object); err != nil {
m.RUnlock()
Expand All @@ -631,7 +631,7 @@ func (m *vortexManipulator) backgroundSync(ctx context.Context) {

// Update the local copy of the object now.
if err := m.commitLocal(t.Method, t.mctx, t.Object); err != nil {
zap.L().Error("failed to delete local object after failed resync", zap.Error(err))
zap.L().Error("failed to commit object downstream", zap.Error(err))
}

m.RUnlock()
Expand Down
17 changes: 17 additions & 0 deletions manipvortex/manipulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func Test_New(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
)
So(err, ShouldBeNil)
So(v, ShouldNotBeNil)
Expand Down Expand Up @@ -150,6 +151,7 @@ func Test_UnsupportedMethods(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
)
So(err, ShouldBeNil)

Expand Down Expand Up @@ -181,6 +183,7 @@ func Test_Count(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
)
So(err, ShouldBeNil)

Expand Down Expand Up @@ -217,6 +220,7 @@ func Test_run(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionTransactionLog("./testlog"),
)
So(err, ShouldBeNil)
Expand All @@ -241,6 +245,7 @@ func Test_run(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionTransactionLog("./bad-directory/test"),
)
So(err, ShouldNotBeNil)
Expand All @@ -262,6 +267,7 @@ func Test_run(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionUpstreamSubscriber(s),
)
So(err, ShouldNotBeNil)
Expand All @@ -283,6 +289,7 @@ func Test_run(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionUpstreamSubscriber(s),
)
So(err, ShouldBeNil)
Expand Down Expand Up @@ -321,6 +328,7 @@ func Test_RetrieveMany(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
)
So(err, ShouldBeNil)

Expand Down Expand Up @@ -395,6 +403,7 @@ func Test_Retrieve(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
)
So(err, ShouldBeNil)

Expand Down Expand Up @@ -481,6 +490,7 @@ func Test_Create(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionDownstreamReconciler(a),
)
So(err, ShouldBeNil)
Expand Down Expand Up @@ -603,6 +613,7 @@ func Test_Update(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionDownstreamReconciler(a),
)
So(err, ShouldBeNil)
Expand Down Expand Up @@ -735,6 +746,7 @@ func Test_Delete(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionDownstreamReconciler(a),
)
So(err, ShouldBeNil)
Expand Down Expand Up @@ -963,6 +975,7 @@ func Test_WriteThroughBackend(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
)
So(err, ShouldBeNil)

Expand Down Expand Up @@ -1136,6 +1149,7 @@ func Test_Monitor(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionUpstreamSubscriber(s),
OptionDownstreamReconciler(a),
)
Expand Down Expand Up @@ -1323,6 +1337,7 @@ func Test_WriteBackBackend(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyNone),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
)
So(err, ShouldBeNil)

Expand Down Expand Up @@ -1494,6 +1509,7 @@ func Test_SubscriberRegistration(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionUpstreamSubscriber(us),
)
So(err, ShouldBeNil)
Expand Down Expand Up @@ -1535,6 +1551,7 @@ func Test_updateFilter(t *testing.T) {
newIdentityProcessor(manipulate.ReadConsistencyDefault, manipulate.WriteConsistencyDefault),
testmodel.Manager(),
OptionUpstreamManipulator(m),
OptionPrefetcher(NewDefaultPrefetcher()),
OptionUpstreamSubscriber(us),
)
So(err, ShouldBeNil)
Expand Down
1 change: 0 additions & 1 deletion manipvortex/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func newConfig() *config {
writeConsistency: manipulate.WriteConsistencyStrong,
defaultQueueDuration: time.Second,
defaultPageSize: 10000,
prefetcher: NewDefaultPrefetcher(),
}
}

Expand Down

0 comments on commit 2a9a3c7

Please sign in to comment.