fix(core): update
This commit is contained in:
parent
60a0fab9db
commit
24f82fe570
10362
package-lock.json
generated
10362
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -23,20 +23,18 @@
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.63",
|
||||
"@gitzone/tsbundle": "^2.0.4",
|
||||
"@gitzone/tsrun": "^1.2.34",
|
||||
"@gitzone/tsrun": "^1.2.39",
|
||||
"@gitzone/tstest": "^1.0.71",
|
||||
"@pushrocks/tapbundle": "^5.0.3",
|
||||
"@types/node": "^17.0.35",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
"@types/node": "^18.11.18"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
"@pushrocks/smartmatch": "^1.0.7",
|
||||
"@pushrocks/smartmatch": "^2.0.0",
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smartrx": "^2.0.25",
|
||||
"@pushrocks/smarttime": "^3.0.45",
|
||||
"@types/minimatch": "^3.0.5",
|
||||
"@pushrocks/smartrx": "^3.0.0",
|
||||
"@pushrocks/smarttime": "^4.0.1",
|
||||
"@types/minimatch": "^5.1.2",
|
||||
"@types/symbol-tree": "^3.2.2",
|
||||
"symbol-tree": "^3.2.4"
|
||||
},
|
||||
|
4386
pnpm-lock.yaml
generated
Normal file
4386
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/lik',
|
||||
version: '6.0.0',
|
||||
version: '6.0.1',
|
||||
description: 'light little helpers for node'
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
export * from './lik.asyncexecutionstack.js'
|
||||
export * from './lik.fastmap.js';
|
||||
export * from './lik.interestmap.js';
|
||||
export * from './lik.interestmap.interest.js';
|
||||
|
25
ts/lik.asyncexecutionstack.ts
Normal file
25
ts/lik.asyncexecutionstack.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import * as plugins from './lik.plugins.js'
|
||||
|
||||
/**
|
||||
* allows for avoiding race condition
|
||||
*/
|
||||
export class AsyncExecutionStack {
|
||||
public currentExecutions: Promise<any>[] = [];
|
||||
public async getExclusiveExecutionSlot(funcArg: () => Promise<any>, timeoutArg: number) {
|
||||
const executionDeferred = plugins.smartpromise.defer();
|
||||
this.currentExecutions.push(executionDeferred.promise);
|
||||
for (const promiseArg of this.currentExecutions) {
|
||||
if (promiseArg !== executionDeferred.promise) {
|
||||
await promiseArg;
|
||||
} else {
|
||||
if (timeoutArg) {
|
||||
await Promise.race([funcArg(),plugins.smartdelay.delayFor(timeoutArg)])
|
||||
} else {
|
||||
await funcArg();
|
||||
}
|
||||
executionDeferred.resolve();
|
||||
this.currentExecutions.shift();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
10
tsconfig.json
Normal file
10
tsconfig.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user