Destroying knex when done to ensure process exit.
This commit is contained in:
parent
a82fcf1e0a
commit
d044aff9dd
|
@ -4168,11 +4168,6 @@
|
|||
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz",
|
||||
"integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA=="
|
||||
},
|
||||
"node-pre-gyp": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz",
|
||||
|
@ -5407,11 +5402,6 @@
|
|||
"tweetnacl": "~0.14.0"
|
||||
}
|
||||
},
|
||||
"stackback": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
|
||||
"integrity": "sha1-Gsig2Ug4SNFpXkGLbQMaPDzmjjs="
|
||||
},
|
||||
"static-extend": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
|
||||
|
@ -6046,14 +6036,6 @@
|
|||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
|
||||
},
|
||||
"why-is-node-running": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.1.0.tgz",
|
||||
"integrity": "sha512-oLmJ1uZOaKra+GDmYcUHMnVhi4CnZnlt4IE3J05ZDSEAiejeB5dMoR4a4rGcMWRy1Avx24dGTw8yxJ/+EmwPBQ==",
|
||||
"requires": {
|
||||
"stackback": "0.0.2"
|
||||
}
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||
|
|
|
@ -48,12 +48,10 @@
|
|||
"knex-migrate": "^1.7.1",
|
||||
"moment": "^2.24.0",
|
||||
"neo-blessed": "^0.2.0",
|
||||
"node-fetch": "^2.3.0",
|
||||
"opn": "^5.4.0",
|
||||
"sqlite3": "^4.0.6",
|
||||
"tough-cookie": "^3.0.1",
|
||||
"tty-table": "^2.7.0",
|
||||
"why-is-node-running": "^2.1.0",
|
||||
"yargs": "^13.2.2"
|
||||
}
|
||||
}
|
||||
|
|
26
src/app.js
26
src/app.js
|
@ -1,6 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const log = require('why-is-node-running');
|
||||
const blessed = require('neo-blessed');
|
||||
const clipboard = require('clipboardy');
|
||||
|
||||
|
@ -44,24 +43,27 @@ function getMethod() {
|
|||
async function init() {
|
||||
const screen = argv.render && !argv.filename && initScreen();
|
||||
|
||||
|
||||
try {
|
||||
const method = getMethod();
|
||||
const result = await method.fetch();
|
||||
|
||||
if (argv.copy && result.copy) {
|
||||
clipboard.writeSync(result.copy);
|
||||
console.log(`Result copied to clipboard: ${result.copy}`);
|
||||
}
|
||||
if (result) {
|
||||
if (argv.copy && result.copy) {
|
||||
clipboard.writeSync(result.copy);
|
||||
console.log(`Result copied to clipboard: ${result.copy}`);
|
||||
}
|
||||
|
||||
if (argv.filename && result.filename) {
|
||||
console.log(result.filename);
|
||||
if (argv.filename && result.filename) {
|
||||
console.log(result.filename);
|
||||
|
||||
setTimeout(() => log(), 5000);
|
||||
return;
|
||||
}
|
||||
// setTimeout(() => log(), 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
if (argv.render) {
|
||||
method.render(result, screen);
|
||||
if (argv.render) {
|
||||
method.render(result, screen);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(argv.debug ? error : error.message);
|
||||
|
|
|
@ -176,6 +176,8 @@ async function fetchReleases() {
|
|||
return [];
|
||||
}));
|
||||
|
||||
knex.destroy();
|
||||
|
||||
const accumulatedScenes = scenesPerSite.reduce((acc, siteScenes) => ([...acc, ...siteScenes]), []);
|
||||
const sortedScenes = accumulatedScenes.sort(({ date: dateA }, { date: dateB }) => moment(dateB).diff(dateA));
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@ async function fetchScene(url) {
|
|||
const scene = await scraper.fetchScene(url, site);
|
||||
const filename = deriveFilename(scene);
|
||||
|
||||
knex.destroy();
|
||||
|
||||
return {
|
||||
...scene,
|
||||
filename,
|
||||
|
|
Loading…
Reference in New Issue