Skip to content

Commit

Permalink
Add graph commits to OrientIOInterpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsMeijers committed Oct 2, 2016
1 parent 7056b19 commit 07be009
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/scala/oriented/syntax/syntax.scala
Expand Up @@ -56,6 +56,8 @@ package object syntax {

val result = orientIO.foldMap(unsafeInterpreter)

if(enableTransactions) graph.commit()

graph.shutdown()

result
Expand All @@ -82,7 +84,9 @@ package object syntax {

val result = orientIO.foldMap(tryInterpreter)

if(result.isFailure && enableTransactions) graph.rollback()
if(result.isFailure && enableTransactions)
graph.rollback()
else if(enableTransactions) graph.commit()

graph.shutdown()

Expand Down Expand Up @@ -135,6 +139,7 @@ package object syntax {
})

result.onSuccess(PartialFunction { _ =>
if(enableTransactions) graph.commit()
graph.shutdown()
})

Expand All @@ -158,10 +163,10 @@ package object syntax {
else orientClient.graphNoTransaction

val interpreter: OrientProgram ~> EitherT[Future, Throwable, ?] =
SafeAsyncEdgeInterpreter() or
(SafeAsyncVertexInterpreter() or
SafeAsyncEdgeInterpreter() or
(SafeAsyncVertexInterpreter() or
(SafeAsyncElementInterpreter() or
(SafeAsyncClientInterpreter() or
(SafeAsyncClientInterpreter() or
SafeAsyncSqlInterpreter())))


Expand All @@ -176,6 +181,7 @@ package object syntax {

isLeft.onSuccess(PartialFunction { failed =>
if(failed && enableTransactions) graph.rollback()
else if(enableTransactions) graph.commit()
graph.shutdown()
})

Expand Down

0 comments on commit 07be009

Please sign in to comment.