Commit 9abf028ebc9401a7ab89e1b9a71b915b79a5757d
flush before closing
Dominic Tarr committed on 1/18/2019, 9:40:00 PMParent: dd961e4fbaf5321a314266adbcd32ac22ec3d413
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -52,13 +52,16 @@ | ||
52 | 52 | var feed = ssb.createFeed(opts.keys, {remote: true}) |
53 | 53 | var _close = api.close |
54 | 54 | var close = function (arg, cb) { |
55 | 55 | if('function' === typeof arg) cb = arg |
56 | - // override to close the SSB database | |
57 | - ssb.close(function (err) { | |
58 | - if (err) throw err | |
59 | - console.log("fallback to close") | |
60 | - _close(cb) //multiserver doesn't take a callback on close. | |
56 | + ssb.flush(function (err) { | |
57 | + if(err) return cb(err) | |
58 | + // override to close the SSB database | |
59 | + ssb.close(function (err) { | |
60 | + if (err) return cb(err) | |
61 | + console.log("fallback to close") | |
62 | + _close(cb) //multiserver doesn't take a callback on close. | |
63 | + }) | |
61 | 64 | }) |
62 | 65 | } |
63 | 66 | |
64 | 67 | function since () { |
Built with git-ssb-web