@@ -38,15 +38,16 @@ class Session {
3838 * @param {string } mode the default access mode for this session.
3939 * @param {ConnectionProvider } connectionProvider - the connection provider to acquire connections from.
4040 * @param {string } [bookmark=undefined] - the initial bookmark for this session.
41+ * @param {Object } [config={}] - this driver configuration.
4142 */
42- constructor ( mode , connectionProvider , bookmark ) {
43+ constructor ( mode , connectionProvider , bookmark , config ) {
4344 this . _mode = mode ;
4445 this . _readConnectionHolder = new ConnectionHolder ( READ , connectionProvider ) ;
4546 this . _writeConnectionHolder = new ConnectionHolder ( WRITE , connectionProvider ) ;
4647 this . _open = true ;
4748 this . _hasTx = false ;
4849 this . _lastBookmark = bookmark ;
49- this . _transactionExecutor = new TransactionExecutor ( )
50+ this . _transactionExecutor = _createTransactionExecutor ( config ) ;
5051 }
5152
5253 /**
@@ -134,7 +135,7 @@ class Session {
134135 * Transaction will automatically be committed unless the given function throws or returns a rejected promise.
135136 * Some failures of the given function or the commit itself will be retried with exponential backoff with initial
136137 * delay of 1 second and maximum retry time of 30 seconds. Maximum retry time is configurable via driver config's
137- * { @link # maxTransactionRetryTime} property in milliseconds.
138+ * <code> maxTransactionRetryTime</code> property in milliseconds.
138139 *
139140 * @param {function(Transaction) } transactionWork - callback that executes operations against
140141 * a given {@link Transaction}.
@@ -151,7 +152,7 @@ class Session {
151152 * Transaction will automatically be committed unless the given function throws or returns a rejected promise.
152153 * Some failures of the given function or the commit itself will be retried with exponential backoff with initial
153154 * delay of 1 second and maximum retry time of 30 seconds. Maximum retry time is configurable via driver config's
154- * { @link # maxTransactionRetryTime} property in milliseconds.
155+ * <code> maxTransactionRetryTime</code> property in milliseconds.
155156 *
156157 * @param {function(Transaction) } transactionWork - callback that executes operations against
157158 * a given {@link Transaction}.
@@ -232,4 +233,9 @@ class _RunObserver extends StreamObserver {
232233 }
233234}
234235
236+ function _createTransactionExecutor ( config ) {
237+ const maxRetryTimeMs = ( config && config . maxTransactionRetryTime ) ? config . maxTransactionRetryTime : null ;
238+ return new TransactionExecutor ( maxRetryTimeMs ) ;
239+ }
240+
235241export default Session ;
0 commit comments