Comparing version 7.7.0 to 7.8.0
@@ -17,2 +17,11 @@ # Changelog | ||
## [7.8.0] - 2022-05-19 | ||
### Added | ||
- Added `retryOnConflict` option to `db.query` and `route.request` | ||
This option allows specifying the number of times the request will be retried | ||
if it results in a write-write conflict. | ||
## [7.7.0] - 2022-01-26 | ||
@@ -1287,2 +1296,3 @@ | ||
[7.8.0]: https://github.com/arangodb/arangojs/compare/v7.7.0...v7.8.0 | ||
[7.7.0]: https://github.com/arangodb/arangojs/compare/v7.6.1...v7.7.0 | ||
@@ -1289,0 +1299,0 @@ [7.6.1]: https://github.com/arangodb/arangojs/compare/v7.6.0...v7.6.1 |
@@ -201,2 +201,9 @@ /// <reference types="node" /> | ||
/** | ||
* If set to a positive number, the request will automatically be retried at | ||
* most this many times if it results in a write-write conflict. | ||
* | ||
* Default: `0` | ||
*/ | ||
retryOnConflict?: number; | ||
/** | ||
* HTTP headers to pass along with this request in addition to the default | ||
@@ -234,2 +241,3 @@ * headers generated by arangojs. | ||
allowDirtyRead: boolean; | ||
retryOnConflict: number; | ||
resolve: (res: ArangojsResponse) => void; | ||
@@ -586,5 +594,5 @@ reject: (error: Error) => void; | ||
*/ | ||
request<T = ArangojsResponse>({ host, method, body, expectBinary, isBinary, allowDirtyRead, timeout, headers, ...urlInfo }: RequestOptions, transform?: (res: ArangojsResponse) => T): Promise<T>; | ||
request<T = ArangojsResponse>({ host, method, body, expectBinary, isBinary, allowDirtyRead, retryOnConflict, timeout, headers, ...urlInfo }: RequestOptions, transform?: (res: ArangojsResponse) => T): Promise<T>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=connection.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
const btoa_1 = require("./lib/btoa"); | ||
const codes_1 = require("./lib/codes"); | ||
const normalizeUrl_1 = require("./lib/normalizeUrl"); | ||
@@ -181,3 +182,9 @@ const request_1 = require("./lib/request"); | ||
} | ||
if (!task.host && | ||
if (error_1.isArangoError(err) && | ||
err.errorNum === codes_1.ERROR_ARANGO_CONFLICT && | ||
task.retryOnConflict > 0) { | ||
task.retryOnConflict -= 1; | ||
this._queue.push(task); | ||
} | ||
else if (!task.host && | ||
this._shouldRetry && | ||
@@ -373,3 +380,3 @@ task.retries < (this._maxRetries || this._hosts.length - 1) && | ||
*/ | ||
request({ host, method = "GET", body, expectBinary = false, isBinary = false, allowDirtyRead = false, timeout = 0, headers, ...urlInfo }, transform) { | ||
request({ host, method = "GET", body, expectBinary = false, isBinary = false, allowDirtyRead = false, retryOnConflict = 0, timeout = 0, headers, ...urlInfo }, transform) { | ||
return new Promise((resolve, reject) => { | ||
@@ -401,2 +408,3 @@ let contentType = "text/plain"; | ||
allowDirtyRead, | ||
retryOnConflict, | ||
options: { | ||
@@ -403,0 +411,0 @@ url: this._buildUrl(urlInfo), |
@@ -11,2 +11,3 @@ /** | ||
export declare const TRANSACTION_NOT_FOUND = 10; | ||
export declare const ERROR_ARANGO_CONFLICT = 1200; | ||
export declare const ANALYZER_NOT_FOUND = 1202; | ||
@@ -13,0 +14,0 @@ export declare const DOCUMENT_NOT_FOUND = 1202; |
@@ -12,4 +12,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GRAPH_NOT_FOUND = exports.DATABASE_NOT_FOUND = exports.VIEW_NOT_FOUND = exports.COLLECTION_NOT_FOUND = exports.DOCUMENT_NOT_FOUND = exports.ANALYZER_NOT_FOUND = exports.TRANSACTION_NOT_FOUND = void 0; | ||
exports.GRAPH_NOT_FOUND = exports.DATABASE_NOT_FOUND = exports.VIEW_NOT_FOUND = exports.COLLECTION_NOT_FOUND = exports.DOCUMENT_NOT_FOUND = exports.ANALYZER_NOT_FOUND = exports.ERROR_ARANGO_CONFLICT = exports.TRANSACTION_NOT_FOUND = void 0; | ||
exports.TRANSACTION_NOT_FOUND = 10; | ||
exports.ERROR_ARANGO_CONFLICT = 1200; | ||
exports.ANALYZER_NOT_FOUND = 1202; | ||
@@ -16,0 +17,0 @@ exports.DOCUMENT_NOT_FOUND = 1202; |
{ | ||
"name": "arangojs", | ||
"version": "7.7.0", | ||
"version": "7.8.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19839
2252593