{"_id":"@ambassify/neo4j-retried","_rev":"4-4e61599517b8c73e347f2256132a6cc9","name":"@ambassify/neo4j-retried","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ambassify/neo4j-retried","version":"1.0.0","keywords":["neo4j-driver","neo4j","retry","exponential backoff","backoff","deadlock"],"author":{"name":"Ambassify","email":"dev@ambassify.com"},"license":"MIT","_id":"@ambassify/neo4j-retried@1.0.0","maintainers":[{"name":"ambassify","email":"dev@ambassify.com"}],"homepage":"https://github.com/ambassify/neo4j-retried#readme","bugs":{"url":"https://github.com/ambassify/neo4j-retried/issues"},"dist":{"shasum":"ca8cf8b4e7b376c9d605ec7cffb73df68e796068","tarball":"https://registry.npmjs.org/@ambassify/neo4j-retried/-/neo4j-retried-1.0.0.tgz","integrity":"sha512-FAX2gbH3sXwNNs5nat4pMpAviB+NFP070TGerso5DF+/nXOU9y+fyu1exrftmIqjZl5SOmwLmVOYll0URDDwrA==","signatures":[{"sig":"MEYCIQCxo1uPQ6cII1HPZluGRSe7K9V6IqRnWsvryUmg72M21AIhAK5e+spAmv8QMcbgLk/nSYql/SB5ATeCjbyArg+PSiS4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"src/index.js","_from":".","_shasum":"ca8cf8b4e7b376c9d605ec7cffb73df68e796068","gitHead":"86e116032e5fefafd05f523072b47f53df262908","scripts":{"test":"npm -s run test:lint && npm -s run test:unit","release":"npm version patch && npm publish","test:lint":"eslint src","test:unit":"nyc mocha"},"_npmUser":{"name":"ambassify","email":"dev@ambassify.com"},"repository":{"url":"git+https://github.com/ambassify/neo4j-retried.git","type":"git"},"_npmVersion":"3.10.10","description":"Retry queries run against the neo4j driver. Great for handling deadlock exceptions.","_nodeVersion":"6.10.0","dependencies":{"@ambassify/backoff-strategies":"^1.0.0"},"devDependencies":{"nyc":"^10.1.2","mocha":"^3.2.0","sinon":"^1.17.7","eslint":"^3.12.2","neo4j-driver":"^1.1.1","eslint-config-ambassify":"^1.0.0"},"peerDependencies":{"neo4j-driver":"^1.1.1"},"_npmOperationalInternal":{"tmp":"tmp/neo4j-retried-1.0.0.tgz_1489424253575_0.8277358463965356","host":"packages-12-west.internal.npmjs.com"},"directories":{}}},"time":{"created":"2017-03-13T16:57:35.636Z","modified":"2025-10-09T08:36:34.970Z","1.0.0":"2017-03-13T16:57:35.636Z"},"bugs":{"url":"https://github.com/ambassify/neo4j-retried/issues"},"author":{"name":"Ambassify","email":"dev@ambassify.com"},"license":"MIT","homepage":"https://github.com/ambassify/neo4j-retried#readme","keywords":["neo4j-driver","neo4j","retry","exponential backoff","backoff","deadlock"],"repository":{"url":"git+https://github.com/ambassify/neo4j-retried.git","type":"git"},"description":"Retry queries run against the neo4j driver. Great for handling deadlock exceptions.","maintainers":[{"email":"dev@ambassify.com","name":"ambassify-admin"}],"readme":"# neo4j-retried\n\n![CircleCI](https://img.shields.io/circleci/project/github/ambassify/neo4j-retried.svg)\n[![npm version](https://img.shields.io/npm/v/@ambassify/neo4j-retried.svg)](https://www.npmjs.com/package/@ambassify/neo4j-retried)\n[![npm downloads](https://img.shields.io/npm/dt/@ambassify/neo4j-retried.svg)](https://www.npmjs.com/package/@ambassify/neo4j-retried)\n[![maintainer](https://img.shields.io/badge/maintainer-Gertt-brightgreen.svg)](https://github.com/Gertt)\n\nRetry queries run against the neo4j driver. Great for handling deadlock exceptions.\n\n## Important caveat\n\nThe retried wrapper only works if you use neo4j-driver with promises, it does\nnot handle the `.subscribe()` way.\n\n## Installation\n\n```shell\nnpm install --save @ambassify/neo4j-retried\n```\n\n## Example\n\nAutomatically retry DeadlockDetected exceptions.\n\n```js\nconst neo4j = require('neo4j-driver').v1;\nconst neo4jRetried = require('@ambassify/neo4j-retried');\n\nconst driver = neo4jRetried(neo4j.driver(/* your driver config */), {\n    shouldRetry: [ neo4jRetried.errors.Transaction.DeadlockDetected ]\n});\nconst session = driver.session();\n\nsession.run('CREATE CONSTRAINT ON (p:Person) ASSERT p.name IS UNIQUE')\n.catch(e => {\n    console.log(e);\n    session.close();\n    driver.close();\n});\n```\n\n## Options\n\n**retries**\n\nThe amount of times a query should be retried.\n\n**delay**\n\nThe delay between retries, can be an integer or a function.\n\nIn case of integer, the value is used as slot time in a binary exponential backoff algorithm (https://en.wikipedia.org/wiki/Exponential_backoff)\n\nIn case of a function, the function is called with the total amount of previous calls as first parameter and should return the delay in ms.\n\n**shouldRetry**\n\nDecides whether or not a failure should be retried. Can be an array of Neo4j error codes that should be retried or a function that accepts the error that occurred and returns a boolean.\n\n## Contribute\n\nWe really appreciate any contribution you would like to make, so don't\nhesitate to report issues or submit pull requests.\n\n## License\n\nThis project is released under a MIT license.\n\n## About us\n\nIf you would like to know more about us, be sure to have a look at [our website](https://www.ambassify.com), or our Twitter accounts [Ambassify](https://twitter.com/Ambassify), [Sitebase](https://twitter.com/Sitebase), [JorgenEvens](https://twitter.com/JorgenEvens)\n","readmeFilename":"README.md"}