-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite3: add interrupt method #40747
sqlite3: add interrupt method #40747
Conversation
@@ -89,6 +89,7 @@ export class Database extends events.EventEmitter { | |||
on(event: string, listener: (...args: any[]) => void): this; | |||
|
|||
configure(option: "busyTimeout", value: number): void; | |||
interrupt(): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may throw an error.
For example, error has happened when database is not opened:
$ node index.js
/Users/user/work/js/test-sqlite3/index.js:3
db.interrupt();
^
Error: Database is not open
at Object.<anonymous> (/Users/user/work/js/test-sqlite3/index.js:3:4)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:67:12)
at internal/main/run_main_module.js:17:47
Source:
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(':memory:');
db.interrupt();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not cause an error.
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(':memory:');
db.each('select 1', err => {
db.interrupt();
});
👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings. Let’s review the numbers, shall we? Comparison details 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
@mtgto Thank you for submitting this PR! 🔔 @nmalaguti @dpyro @BehindTheMath - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience! |
Thanks for the patience! |
Thanks for your review 😺 |
Add interrupt to type definition. This function is released since v3.1.5 (5 Oct 2016).
TryGhost/node-sqlite3#518
https://github.com/mapbox/node-sqlite3/blob/4f61a03c60cb827b7cad7f624f34e607779b85d9/CHANGELOG.md#315
P.S. API document of node-sqlite3 doesn't have interrupt now.
TryGhost/node-sqlite3#1205 (comment)
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).If changing an existing definition:
tslint.json
containing{ "extends": "dtslint/dt.json" }
. If for reason the any rule need to be disabled, disable it for that line using// tslint:disable-next-line [ruleName]
and not for whole package so that the need for disabling can be reviewed.