fix(core): update
This commit is contained in:
parent
801e2ad266
commit
86b2842ed2
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm publish
|
||||
|
||||
metadata:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
run: |
|
||||
npmci command npm install -g typescript
|
||||
npmci npm install
|
||||
|
||||
- name: Trigger
|
||||
run: npmci trigger
|
||||
|
||||
- name: Build docs and upload artifacts
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @gitzone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
141
.gitlab-ci.yml
141
.gitlab-ci.yml
@ -1,141 +0,0 @@
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- npm install -g @shipzone/npmci
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
allow_failure: true
|
@ -8,10 +8,10 @@
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "taskbuffer",
|
||||
"shortDescription": "flexible task management. TypeScript ready!",
|
||||
"npmPackagename": "@pushrocks/taskbuffer",
|
||||
"description": "flexible task management. TypeScript ready!",
|
||||
"npmPackagename": "@push.rocks/taskbuffer",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
23
package.json
23
package.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@pushrocks/taskbuffer",
|
||||
"name": "@push.rocks/taskbuffer",
|
||||
"version": "3.0.10",
|
||||
"private": false,
|
||||
"description": "flexible task management. TypeScript ready!",
|
||||
@ -8,7 +8,8 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web && tsbundle npm)"
|
||||
"build": "(tsbuild --web && tsbundle npm)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -28,20 +29,20 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
||||
"dependencies": {
|
||||
"@pushrocks/isounique": "^1.0.5",
|
||||
"@pushrocks/lik": "^6.0.0",
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
"@pushrocks/smartlog": "^3.0.1",
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smartrx": "^3.0.0",
|
||||
"@pushrocks/smarttime": "^4.0.1"
|
||||
"@push.rocks/isounique": "^1.0.5",
|
||||
"@push.rocks/lik": "^6.0.0",
|
||||
"@push.rocks/smartdelay": "^3.0.5",
|
||||
"@push.rocks/smartlog": "^3.0.1",
|
||||
"@push.rocks/smartpromise": "^4.0.3",
|
||||
"@push.rocks/smartrx": "^3.0.0",
|
||||
"@push.rocks/smarttime": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.63",
|
||||
"@gitzone/tsbundle": "^2.0.6",
|
||||
"@gitzone/tsrun": "^1.2.39",
|
||||
"@gitzone/tstest": "^1.0.72",
|
||||
"@pushrocks/tapbundle": "^5.0.4",
|
||||
"@push.rocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^18.11.18"
|
||||
},
|
||||
"files": [
|
||||
@ -59,4 +60,4 @@
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
}
|
1618
pnpm-lock.yaml
generated
1618
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
30
readme.md
30
readme.md
@ -1,27 +1,26 @@
|
||||
# @pushrocks/taskbuffer
|
||||
# @push.rocks/taskbuffer
|
||||
flexible task management. TypeScript ready!
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/taskbuffer)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/taskbuffer)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/taskbuffer)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/taskbuffer/)
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/taskbuffer)
|
||||
* [gitlab.com (source)](https://gitlab.com/push.rocks/taskbuffer)
|
||||
* [github.com (source mirror)](https://github.com/push.rocks/taskbuffer)
|
||||
* [docs (typedoc)](https://push.rocks.gitlab.io/taskbuffer/)
|
||||
|
||||
## Status for master
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/taskbuffer/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/taskbuffer/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/taskbuffer)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/taskbuffer)](https://lossless.cloud)
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/taskbuffer/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/taskbuffer/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/taskbuffer)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/taskbuffer)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/taskbuffer)](https://lossless.cloud)
|
||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
@ -57,7 +56,6 @@ We are always happy for code contributions. If you are not the code contributing
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
|
||||
// setup some testData to work with
|
||||
let testTask: taskbuffer.Task;
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
|
||||
let task1Executed = false;
|
||||
const task1 = new taskbuffer.Task({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
|
||||
let myTaskManager: taskbuffer.TaskManager;
|
||||
let taskRunCounter = 0;
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
|
||||
const flowTask1 = new taskbuffer.Task({
|
||||
taskFunction: (x: number) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts/index.js';
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/taskbuffer',
|
||||
version: '3.0.10',
|
||||
name: '@push.rocks/taskbuffer',
|
||||
version: '3.0.11',
|
||||
description: 'flexible task management. TypeScript ready!'
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
export { Task } from './taskbuffer.classes.task.js';
|
||||
export type { ITaskFunction } from './taskbuffer.classes.task.js'
|
||||
export type { ITaskFunction } from './taskbuffer.classes.task.js';
|
||||
export { Taskchain } from './taskbuffer.classes.taskchain.js';
|
||||
export { Taskparallel } from './taskbuffer.classes.taskparallel.js';
|
||||
export { TaskManager } from './taskbuffer.classes.taskmanager.js';
|
||||
@ -7,6 +7,4 @@ export { TaskOnce } from './taskbuffer.classes.taskonce.js';
|
||||
export { TaskRunner } from './taskbuffer.classes.taskrunner.js';
|
||||
export { TaskDebounced } from './taskbuffer.classes.taskdebounced.js';
|
||||
import * as distributedCoordination from './taskbuffer.classes.distributedcoordinator.js';
|
||||
export {
|
||||
distributedCoordination
|
||||
}
|
||||
export { distributedCoordination };
|
||||
|
@ -22,6 +22,9 @@ export interface IDistributedTaskRequestResult {
|
||||
* this needs to correlate to the decisionInfoBasis
|
||||
*/
|
||||
submitterRandomId: string;
|
||||
/**
|
||||
* can be used while debugging
|
||||
*/
|
||||
considered: boolean;
|
||||
rank: string;
|
||||
reason: string;
|
||||
@ -29,6 +32,10 @@ export interface IDistributedTaskRequestResult {
|
||||
}
|
||||
|
||||
export abstract class AbstractDistributedCoordinator {
|
||||
public abstract fireDistributedTaskRequest(infoBasisArg: IDistributedTaskRequest): Promise<IDistributedTaskRequestResult>
|
||||
public abstract updateDistributedTaskRequest(infoBasisArg: IDistributedTaskRequest): Promise<void>
|
||||
}
|
||||
public abstract fireDistributedTaskRequest(
|
||||
infoBasisArg: IDistributedTaskRequest
|
||||
): Promise<IDistributedTaskRequestResult>;
|
||||
public abstract updateDistributedTaskRequest(
|
||||
infoBasisArg: IDistributedTaskRequest
|
||||
): Promise<void>;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export interface ICronJob {
|
||||
}
|
||||
|
||||
export interface ITaskManagerConstructorOptions {
|
||||
distributedCoordinator?: AbstractDistributedCoordinator
|
||||
distributedCoordinator?: AbstractDistributedCoordinator;
|
||||
}
|
||||
|
||||
export class TaskManager {
|
||||
@ -18,7 +18,7 @@ export class TaskManager {
|
||||
private cronJobManager = new plugins.smarttime.CronManager();
|
||||
|
||||
public options: ITaskManagerConstructorOptions = {
|
||||
distributedCoordinator: null
|
||||
distributedCoordinator: null,
|
||||
};
|
||||
|
||||
constructor(optionosArg: ITaskManagerConstructorOptions = {}) {
|
||||
@ -78,36 +78,40 @@ export class TaskManager {
|
||||
*/
|
||||
public scheduleTaskByName(taskNameArg: string, cronStringArg: string) {
|
||||
const taskToSchedule = this.getTaskByName(taskNameArg);
|
||||
const cronJob = this.cronJobManager.addCronjob(cronStringArg, async (triggerTimeArg: number) => {
|
||||
console.log(`taskbuffer schedule triggered task >>${taskToSchedule.name}<<`);
|
||||
console.log(
|
||||
`task >>${taskToSchedule.name}<< is ${
|
||||
taskToSchedule.buffered
|
||||
? `buffered with max ${taskToSchedule.bufferMax} buffered calls`
|
||||
: `unbuffered`
|
||||
}`
|
||||
);
|
||||
if (this.options.distributedCoordinator) {
|
||||
console.log(`Found a distrubuted coordinator, performing distributed consultation.`);
|
||||
const announcementResult = await this.options.distributedCoordinator.fireDistributedTaskRequest({
|
||||
submitterRandomId: this.randomId,
|
||||
status: 'requesting',
|
||||
taskExecutionParallel: 1,
|
||||
taskExecutionTime: triggerTimeArg,
|
||||
taskExecutionTimeout: taskToSchedule.timeout,
|
||||
taskName: taskToSchedule.name,
|
||||
taskVersion: taskToSchedule.version,
|
||||
});
|
||||
const cronJob = this.cronJobManager.addCronjob(
|
||||
cronStringArg,
|
||||
async (triggerTimeArg: number) => {
|
||||
console.log(`taskbuffer schedule triggered task >>${taskToSchedule.name}<<`);
|
||||
console.log(
|
||||
`task >>${taskToSchedule.name}<< is ${
|
||||
taskToSchedule.buffered
|
||||
? `buffered with max ${taskToSchedule.bufferMax} buffered calls`
|
||||
: `unbuffered`
|
||||
}`
|
||||
);
|
||||
if (this.options.distributedCoordinator) {
|
||||
console.log(`Found a distrubuted coordinator, performing distributed consultation.`);
|
||||
const announcementResult =
|
||||
await this.options.distributedCoordinator.fireDistributedTaskRequest({
|
||||
submitterRandomId: this.randomId,
|
||||
status: 'requesting',
|
||||
taskExecutionParallel: 1,
|
||||
taskExecutionTime: triggerTimeArg,
|
||||
taskExecutionTimeout: taskToSchedule.timeout,
|
||||
taskName: taskToSchedule.name,
|
||||
taskVersion: taskToSchedule.version,
|
||||
});
|
||||
|
||||
if (!announcementResult.shouldTrigger) {
|
||||
console.log('distributed coordinator result: NOT EXECUTING')
|
||||
return;
|
||||
} else {
|
||||
console.log('distributed coordinator result: CHOSEN AND EXECUTING')
|
||||
if (!announcementResult.shouldTrigger) {
|
||||
console.log('distributed coordinator result: NOT EXECUTING');
|
||||
return;
|
||||
} else {
|
||||
console.log('distributed coordinator result: CHOSEN AND EXECUTING');
|
||||
}
|
||||
}
|
||||
await taskToSchedule.trigger();
|
||||
}
|
||||
await taskToSchedule.trigger();
|
||||
});
|
||||
);
|
||||
taskToSchedule.cronJob = cronJob;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as isounique from '@pushrocks/isounique';
|
||||
import * as lik from '@pushrocks/lik';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartrx from '@pushrocks/smartrx';
|
||||
import * as smarttime from '@pushrocks/smarttime';
|
||||
import * as isounique from '@push.rocks/isounique';
|
||||
import * as lik from '@push.rocks/lik';
|
||||
import * as smartlog from '@push.rocks/smartlog';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
import * as smartrx from '@push.rocks/smartrx';
|
||||
import * as smarttime from '@push.rocks/smarttime';
|
||||
|
||||
export { isounique, lik, smartlog, smartpromise, smartdelay, smartrx, smarttime };
|
||||
|
Loading…
Reference in New Issue
Block a user