Skip to content

Commit

Permalink
Merge pull request #91 from fbiville/issue_90
Browse files Browse the repository at this point in the history
Do not send negative transaction timeout values
  • Loading branch information
Eric Solender authored Feb 22, 2022
2 parents e7505e2 + 0006566 commit a8ccfb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sessionv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,11 @@ func (s *SessionV2Impl) runWrite(ctx context.Context, work neo4j.TransactionWork
}

s.gogm.logger.Debug("running in managed write transaction")
_, err := s.neoSess.WriteTransaction(work, neo4j.WithTxTimeout(time.Until(s.getDeadline(ctx))))
duration := time.Until(s.getDeadline(ctx))
if duration < 0 {
duration = 0
}
_, err := s.neoSess.WriteTransaction(work, neo4j.WithTxTimeout(duration))
if err != nil {
return fmt.Errorf("failed to save in auto transaction, %w", err)
}
Expand Down

0 comments on commit a8ccfb6

Please sign in to comment.