now timouts are unrefed making them non blocking for natural process exits

This commit is contained in:
Philipp Kunz 2017-06-05 15:14:07 +02:00
parent 42933e6bb0
commit 95fa33df58
4 changed files with 38 additions and 28 deletions

View File

@ -29,7 +29,9 @@ class TapTools {
}
timeout(timeMilliArg) {
return __awaiter(this, void 0, void 0, function* () {
yield plugins.smartdelay.delayFor(timeMilliArg);
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
timeout.makeUnrefed();
yield timeout.promise;
if (this._tapTest.status === 'pending') {
this._tapTest.status = 'timeout';
}
@ -37,4 +39,4 @@ class TapTools {
}
}
exports.TapTools = TapTools;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUuY2xhc3Nlcy50YXB0b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBRzlDO0lBT0UsWUFBWSxVQUFVO1FBQ3BCLElBQUksQ0FBQyxRQUFRLEdBQUcsVUFBVSxDQUFBO0lBQzVCLENBQUM7SUFFRDs7T0FFRztJQUNILFlBQVk7UUFDVixJQUFJLENBQUMsUUFBUSxDQUFDLGNBQWMsR0FBRyxJQUFJLENBQUE7SUFDckMsQ0FBQztJQUVEOztPQUVHO0lBQ0csUUFBUSxDQUFDLFlBQVk7O1lBQ3pCLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDakQsQ0FBQztLQUFBO0lBRUssT0FBTyxDQUFFLFlBQW9COztZQUNqQyxNQUFNLE9BQU8sQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLFlBQVksQ0FBQyxDQUFBO1lBQy9DLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTS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UFDLFFBQVEsQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFBO1lBQ2xDLENBQUM7UUFDSCxDQUFDO0tBQUE7Q0FFRjtBQWxDRCw0QkFrQ0MifQ==

View File

@ -19,9 +19,9 @@
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": {
"early": "^2.1.1",
"leakage": "^0.2.0",
"leakage": "^0.3.0",
"smartchai": "^1.0.3",
"smartdelay": "^1.0.1",
"smartdelay": "^1.0.3",
"smartq": "^1.1.1",
"typings-global": "^1.0.16"
}

View File

@ -27,7 +27,9 @@ export class TapTools {
}
async timeout (timeMilliArg: number) {
await plugins.smartdelay.delayFor(timeMilliArg)
let timeout = new plugins.smartdelay.Timeout(timeMilliArg)
timeout.makeUnrefed()
await timeout.promise
if (this._tapTest.status === 'pending') {
this._tapTest.status = 'timeout'
}

View File

@ -16,8 +16,8 @@
"@types/chai" "*"
"@types/chai@*", "@types/chai@^3.4.35":
version "3.4.35"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.4.35.tgz#e8d65f83492d2944f816fc620741821c28a8c900"
version "3.5.2"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
"@types/promises-a-plus@*":
version "0.0.27"
@ -46,9 +46,9 @@ bindings@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
brace-expansion@^1.0.0:
version "1.1.6"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
brace-expansion@^1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59"
dependencies:
balanced-match "^0.4.1"
concat-map "0.0.1"
@ -93,18 +93,22 @@ early@^2.1.1:
smartq "^1.1.1"
typings-global "^1.0.16"
es6-error@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
glob@^7.0.0:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
@ -120,13 +124,14 @@ inherits@2:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
interpret@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
version "1.0.3"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
leakage@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.2.0.tgz#9e7a8cc1d241d8c8427e348769e192e172fd8733"
leakage@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
dependencies:
es6-error "^4.0.2"
left-pad "^1.1.3"
memwatch-next "^0.3.0"
minimist "^1.2.0"
@ -143,11 +148,11 @@ memwatch-next@^0.3.0:
bindings "^1.2.1"
nan "^2.3.2"
minimatch@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
brace-expansion "^1.0.0"
brace-expansion "^1.1.7"
minimist@^1.2.0:
version "1.2.0"
@ -182,8 +187,8 @@ rechoir@^0.6.2:
resolve "^1.1.6"
resolve@^1.1.6:
version "1.3.2"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235"
version "1.3.3"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
dependencies:
path-parse "^1.0.5"
@ -210,11 +215,12 @@ smartchai@^1.0.3:
chai-as-promised "^6.0.0"
chai-string "^1.3.0"
smartdelay@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.1.tgz#687f8bcc09d7c62c9c5a8a1771c1aba3aff54156"
smartdelay@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579"
dependencies:
typings-global "^1.0.14"
smartq "^1.1.1"
typings-global "^1.0.16"
smartq@^1.1.1:
version "1.1.1"