Socket
Socket
Sign inDemoInstall

@tngtech/momo-scheduler

Package Overview
Dependencies
228
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.3 to 2.0.4

4

.eslintrc.js

@@ -55,2 +55,6 @@ /* eslint-disable @typescript-eslint/naming-convention */

},
{
selector: 'import',
format: ['camelCase', 'PascalCase'],
},
],

@@ -57,0 +61,0 @@ '@typescript-eslint/no-empty-function': 'error',

@@ -6,2 +6,6 @@ # Change Log

## v2.0.4 (2023-12-01)
- Fix: maxRunning is now always respected, also for longer running jobs ([#706](https://github.com/TNG/momo-scheduler/issues/706))
## v2.0.3 (2023-10-20)

@@ -8,0 +12,0 @@ - Fix: remove error spam when checking for active schedules ([#624](https://github.com/TNG/momo-scheduler/issues/624))

12

dist/repository/SchedulesRepository.js

@@ -73,4 +73,2 @@ "use strict";

}
const deadSchedule = { name: this.name, lastAlive: { $lt: threshold } };
const thisSchedule = { scheduleId: this.scheduleId };
const updatedSchedule = {

@@ -80,4 +78,10 @@ name: this.name,

lastAlive: now,
executions: {},
};
const deadScheduleFilter = { name: this.name, lastAlive: { $lt: threshold } };
const thisScheduleFilter = { scheduleId: this.scheduleId };
// clear executions of a dead schedule
const thisAliveSchedule = yield this.collection.findOne(Object.assign(Object.assign({}, thisScheduleFilter), { lastAlive: { $gte: threshold } }));
if (!thisAliveSchedule) {
updatedSchedule.executions = {};
}
try {

@@ -87,3 +91,3 @@ yield this.collection.updateOne(

// concurrent modification, we use a filter to ensure that we only overwrite a dead schedule or ping this schedule
{ $or: [deadSchedule, thisSchedule] }, { $set: updatedSchedule }, { upsert: true });
{ $or: [deadScheduleFilter, thisScheduleFilter] }, { $set: updatedSchedule }, { upsert: true });
return true;

@@ -90,0 +94,0 @@ }

@@ -42,4 +42,3 @@ import { Connection, MomoConnectionOptions } from '../Connection';

start(): Promise<void>;
private startAllJobs;
id(): string;
}

@@ -59,7 +59,2 @@ "use strict";

}
startAllJobs() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield Promise.all(Object.values(this.getJobSchedulers()).map((jobScheduler) => tslib_1.__awaiter(this, void 0, void 0, function* () { return jobScheduler.start(); })));
});
}
id() {

@@ -66,0 +61,0 @@ return this.scheduleId;

import { ExecutionInfo, JobResult } from '../job/ExecutionInfo';
import { SchedulesRepository } from '../repository/SchedulesRepository';
import { JobRepository } from '../repository/JobRepository';
import { JobScheduler } from '../scheduler/JobScheduler';
import { LogEmitter } from '../logging/LogEmitter';

@@ -109,5 +108,3 @@ import { JobParameters, MomoJob } from '../job/MomoJob';

get(name: string): Promise<MomoJobDescription | undefined>;
protected getJobSchedulers(): {
[name: string]: JobScheduler;
};
protected startAllJobs(): Promise<void>;
}

@@ -197,4 +197,6 @@ "use strict";

}
getJobSchedulers() {
return this.jobSchedulers;
startAllJobs() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield Promise.all(Object.values(this.jobSchedulers).map((jobScheduler) => tslib_1.__awaiter(this, void 0, void 0, function* () { return jobScheduler.start(); })));
});
}

@@ -201,0 +203,0 @@ }

{
"name": "@tngtech/momo-scheduler",
"version": "2.0.3",
"version": "2.0.4",
"description": "momo is a scheduler that persists jobs in mongodb",

@@ -33,8 +33,8 @@ "main": "dist/index.js",

"dependencies": {
"cron": "3.1.3",
"cron": "3.1.6",
"cron-parser": "4.9.0",
"human-interval": "2.0.1",
"lodash": "4.17.21",
"luxon": "3.4.3",
"neverthrow": "6.0.0",
"luxon": "3.4.4",
"neverthrow": "6.1.0",
"typed-emitter": "2.1.0",

@@ -47,19 +47,19 @@ "uuid": "9.0.1"

"devDependencies": {
"@sinonjs/fake-timers": "11.2.1",
"@sinonjs/fake-timers": "11.2.2",
"@types/cron": "2.0.1",
"@types/human-interval": "1.0.1",
"@types/jest": "29.5.6",
"@types/lodash": "4.14.200",
"@types/luxon": "3.3.3",
"@types/node": "18.18.6",
"@types/human-interval": "1.0.2",
"@types/jest": "29.5.10",
"@types/lodash": "4.14.202",
"@types/luxon": "3.3.6",
"@types/node": "20.10.1",
"@types/pino": "7.0.4",
"@types/sinonjs__fake-timers": "8.1.4",
"@types/uuid": "9.0.6",
"@typescript-eslint/eslint-plugin": "6.8.0",
"@typescript-eslint/parser": "6.8.0",
"eslint": "8.51.0",
"@types/sinonjs__fake-timers": "8.1.5",
"@types/uuid": "9.0.7",
"@typescript-eslint/eslint-plugin": "6.13.1",
"@typescript-eslint/parser": "6.13.1",
"eslint": "8.54.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jest": "27.4.2",
"eslint-plugin-jsdoc": "46.8.2",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jest": "27.6.0",
"eslint-plugin-jsdoc": "46.9.0",
"eslint-plugin-markdown": "3.0.1",

@@ -69,10 +69,10 @@ "eslint-plugin-prefer-arrow": "1.2.3",

"jest": "29.7.0",
"mongodb-memory-server": "9.0.1",
"pino": "8.16.0",
"prettier": "3.0.3",
"mongodb-memory-server": "9.1.1",
"pino": "8.16.2",
"prettier": "3.1.0",
"ts-jest": "29.1.1",
"ts-mockito": "2.6.1",
"ts-node": "10.9.1",
"typescript": "5.2.2"
"typescript": "5.3.2"
}
}

@@ -5,8 +5,8 @@ # How to release

2. Open pull request from newly created branch `v{version}-release` to `main`
3. The `Update THIRD_PARTY_NOTICE` workflow will run and update the third party notice on the release branch
4. Make sure that the Changelog is updated
3. Update the changelog and push it to the branch
4. This push triggers the `Update THIRD_PARTY_NOTICE` workflow which will update the third party notice on the release branch
5. Review the PR
6. Merge the PR
7. Run the `release.sh` script on latest `main` (first check with `--dry-run` option)
7. Run the `release.sh` script on latest `main` (first check with `--dry-run` option) with the version set: `./release.sh --version={version} --dry-run`
Check the new version on https://www.npmjs.com/package/@tngtech/momo-scheduler
{
"extends": ["config:base", ":gitSignOff"],
"extends": ["config:base", ":gitSignOff", ":disableDependencyDashboard", ":preserveSemverRanges"],
"rangeStrategy": "pin",

@@ -11,3 +11,3 @@ "lockFileMaintenance": {

{
"matchPackagePatterns": ["^eslint"],
"matchPackagePatterns": ["^eslint", "^@typescript-eslint/"],
"automerge": true,

@@ -19,3 +19,3 @@ "automergeType": "branch",

{
"matchPackagePatterns": ["^@types"],
"matchPackagePatterns": ["^@types/"],
"automerge": true,

@@ -28,3 +28,3 @@ "automergeType": "branch",

"matchDepTypes": ["devDependencies"],
"excludePackagePrefixes": ["eslint", "@types"],
"excludePackagePrefixes": ["eslint", "@types/, @typescript-eslint/"],
"automerge": true,

@@ -31,0 +31,0 @@ "automergeType": "branch",

@@ -85,5 +85,2 @@ import { Filter, FindOneAndUpdateOptions, MongoClient, MongoServerError } from 'mongodb';

const deadSchedule: Filter<ScheduleEntity> = { name: this.name, lastAlive: { $lt: threshold } };
const thisSchedule: Filter<ScheduleEntity> = { scheduleId: this.scheduleId };
const updatedSchedule: Partial<ScheduleEntity> = {

@@ -93,5 +90,13 @@ name: this.name,

lastAlive: now,
executions: {},
};
const deadScheduleFilter: Filter<ScheduleEntity> = { name: this.name, lastAlive: { $lt: threshold } };
const thisScheduleFilter: Filter<ScheduleEntity> = { scheduleId: this.scheduleId };
// clear executions of a dead schedule
const thisAliveSchedule = await this.collection.findOne({ ...thisScheduleFilter, lastAlive: { $gte: threshold } });
if (!thisAliveSchedule) {
updatedSchedule.executions = {};
}
try {

@@ -101,3 +106,3 @@ await this.collection.updateOne(

// concurrent modification, we use a filter to ensure that we only overwrite a dead schedule or ping this schedule
{ $or: [deadSchedule, thisSchedule] },
{ $or: [deadScheduleFilter, thisScheduleFilter] },
{ $set: updatedSchedule },

@@ -104,0 +109,0 @@ { upsert: true },

@@ -87,6 +87,2 @@ import { v4 as uuid } from 'uuid';

private async startAllJobs(): Promise<void> {
await Promise.all(Object.values(this.getJobSchedulers()).map(async (jobScheduler) => jobScheduler.start()));
}
public id(): string {

@@ -93,0 +89,0 @@ return this.scheduleId;

@@ -211,5 +211,5 @@ import { sum } from 'lodash';

protected getJobSchedulers(): { [name: string]: JobScheduler } {
return this.jobSchedulers;
protected async startAllJobs(): Promise<void> {
await Promise.all(Object.values(this.jobSchedulers).map(async (jobScheduler) => jobScheduler.start()));
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc