Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

server-socket-framework-jps

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

server-socket-framework-jps - npm Package Compare versions

Comparing version 1.1.0-2 to 1.1.0-3

2

dist/job/JobManager.d.ts

@@ -14,4 +14,4 @@ import { JobConfig, JobError, JobListener, JobStatus } from "./Job";

addListener(listener: JobListener): void;
protected calculateNextExecuteTime(config: JobConfig): number;
protected calculateNextExecuteTime(config: JobConfig, isAboutToRun?: boolean): number;
addJob(config: JobConfig): void;
}

@@ -39,3 +39,3 @@ "use strict";

// execute the job
queueItem.nextRunTime = this.calculateNextExecuteTime(queueItem.config);
queueItem.nextRunTime = this.calculateNextExecuteTime(queueItem.config, true);
logger(`Executing job ${queueItem.config.name}, next execution time will be ${(0, moment_1.default)(queueItem.nextRunTime, 'YYYYMMDDHHmm').format('DD/MM/YYYY HH:mm')}`);

@@ -52,10 +52,15 @@ queueItem.config.job.executeJob((0, uuid_1.v4)(), this.jobCallback);

}
calculateNextExecuteTime(config) {
calculateNextExecuteTime(config, isAboutToRun = false) {
let nextExecuteTime = 0;
if (config.isDailyJob) {
const now = parseFloat((0, moment_1.default)().format('YYYYMMDDHHmm'));
nextExecuteTime = parseFloat((0, moment_1.default)(`${(0, moment_1.default)().format('YYYYMMDD')}${config.executeDailyAtTime}`, 'YYYYMMDDHHmm').format('YYYYMMDDHHmm'));
if (nextExecuteTime < now) {
if (isAboutToRun) {
nextExecuteTime = parseFloat((0, moment_1.default)(`${(0, moment_1.default)().add(1, 'day').format('YYYYMMDD')}${config.executeDailyAtTime}`, 'YYYYMMDDHHmm').format('YYYYMMDDHHmm'));
}
else {
const now = parseFloat((0, moment_1.default)().format('YYYYMMDDHHmm'));
nextExecuteTime = parseFloat((0, moment_1.default)(`${(0, moment_1.default)().format('YYYYMMDD')}${config.executeDailyAtTime}`, 'YYYYMMDDHHmm').format('YYYYMMDDHHmm'));
if (nextExecuteTime < now) {
nextExecuteTime = parseFloat((0, moment_1.default)(`${(0, moment_1.default)().add(1, 'day').format('YYYYMMDD')}${config.executeDailyAtTime}`, 'YYYYMMDDHHmm').format('YYYYMMDDHHmm'));
}
}
}

@@ -79,3 +84,3 @@ else {

config: config,
nextRunTime: this.calculateNextExecuteTime(config)
nextRunTime: this.calculateNextExecuteTime(config, false)
};

@@ -88,3 +93,3 @@ logger(`Adding daily job ${queueItem.config.name} to queue, next execution time will be ${(0, moment_1.default)(queueItem.nextRunTime, 'YYYYMMDDHHmm').format('DD/MM/YYYY HH:mm')}`);

config: config,
nextRunTime: this.calculateNextExecuteTime(config)
nextRunTime: this.calculateNextExecuteTime(config, false)
};

@@ -91,0 +96,0 @@ logger(`Adding job ${queueItem.config.name} to queue, next execution time will be ${(0, moment_1.default)(queueItem.nextRunTime, 'YYYYMMDDHHmm').format('DD/MM/YYYY HH:mm')}`);

{
"name": "server-socket-framework-jps",
"version": "1.1.0-2",
"version": "1.1.0-3",
"description": "A simple socket framework for persistent chat rooms and data messages",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc