Comparing version 0.5.0 to 0.6.0
@@ -53,2 +53,4 @@ const after = require('after') | ||
}, checkFrequency) | ||
if (db._ttl.intervalId.unref) | ||
db._ttl.intervalId.unref() | ||
} | ||
@@ -55,0 +57,0 @@ |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"homepage": "https://github.com/rvagg/node-level-ttl", | ||
@@ -12,0 +12,0 @@ "authors": [ |
@@ -11,3 +11,3 @@ # Level TTL [![Build Status](https://secure.travis-ci.org/rvagg/node-level-ttl.png)](http://travis-ci.org/rvagg/node-level-ttl) | ||
Requires [LevelUP](https://github.com/rvagg/node-levelup) (or [Level](https://github.com/level/level)) and [sublevel](https://github.com/dominictarr/level-sublevel) to be installed separately. | ||
Requires [LevelUP](https://github.com/rvagg/node-levelup) (or [Level](https://github.com/level/level)) to be installed separately. | ||
@@ -17,6 +17,4 @@ ```js | ||
, ttl = require('level-ttl') | ||
, sublevel = require('level-sublevel') | ||
levelup('/tmp/foo.db', function (err, db) { | ||
db = sublevel(db) | ||
db = ttl(db) | ||
@@ -62,3 +60,3 @@ | ||
**Level TTL** uses a timer to regularly check for expiring entries (don't worry, the whole data store isn't scanned, it's very efficient!) but this can cause problems for processes that have a limited lifespan; particularly when testing. The `db.close()` method is automatically wired to stop the timer but there is also a more explicit <b><code>db.stop()</code></b> method that will stop the timer and not pass on to a `close()` underlying LevelUP instance. | ||
**Level TTL** uses a timer to regularly check for expiring entries (don't worry, the whole data store isn't scanned, it's very efficient!). The `db.close()` method is automatically wired to stop the timer but there is also a more explicit <b><code>db.stop()</code></b> method that will stop the timer and not pass on to a `close()` underlying LevelUP instance. | ||
@@ -65,0 +63,0 @@ ## Contributors |
10
test.js
@@ -18,7 +18,7 @@ const test = require('tape') | ||
t._end = t.end | ||
t.__end = t.end | ||
t.end = function () { | ||
db.close(function (err) { | ||
t.notOk(err, 'no error on close()') | ||
rimraf(location, t._end.bind(t)) | ||
rimraf(location, t.__end.bind(t)) | ||
}) | ||
@@ -371,3 +371,3 @@ } | ||
test('test stop() method stops interval and doesn\'t hold process up', function (t) { | ||
t.plan(8) | ||
t.plan(9) | ||
@@ -417,3 +417,5 @@ var location = '__ttl-' + Math.random() | ||
t.equals(0, intervals, 'all interval timers cleared') | ||
rimraf(location, t.end.bind(t)) | ||
rimraf(location, function () { | ||
t.ok('rimraffed') | ||
}) | ||
}) | ||
@@ -420,0 +422,0 @@ }) |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
617
0
29374
8
71