From 21837d494b604d5c545754edd90cc31e4adc6aef Mon Sep 17 00:00:00 2001 From: Steven Weaver Date: Sat, 23 Nov 2024 14:41:54 -0500 Subject: [PATCH] bump version and update Node.js requirement to v23 or higher in package.json --- lib/hpcsocket.js | 56 +++++++++++++++++++++++++++++++----------------- package.json | 5 ++++- yarn.lock | 14 +----------- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/lib/hpcsocket.js b/lib/hpcsocket.js index 757fb0c8..1dfad88e 100644 --- a/lib/hpcsocket.js +++ b/lib/hpcsocket.js @@ -159,31 +159,47 @@ HPCSocket.prototype.initializeServer = function (url_input, callback) { // Routine status update self.server_socket.on("status update", function (data) { - // Update document with status update - self.job.analysis.status = data.phase; - self.job.analysis.last_status_msg = data.msg; - self.job.analysis.creation_time = data.ctime || self.job.analysis.created; - self.job.analysis.start_time = data.stime || self.job.analysis.start_time; - self.job.analysis.torque_id = data.torque_id; + // Update document fields with status update + self.job.analysis.status = data.phase; + self.job.analysis.last_status_msg = data.msg; + self.job.analysis.creation_time = data.ctime || self.job.analysis.created; + self.job.analysis.start_time = data.stime || self.job.analysis.start_time; + self.job.analysis.torque_id = data.torque_id; + + // Use a flag to ensure save operations do not overlap + if (self.job.analysis._isSaving) { + winston.info("Save in progress. Skipping this update."); + return; // Skip if a save is already in progress + } - //Update the status for the analysis - self.job.analysis.save(function (err, result) { - if (err) throw err; + self.job.analysis._isSaving = true; // Mark as saving - var redis_packet = { - type: "status update", - msg: data.msg, - phase: data.phase, - torque_id: result.torque_id, - start_time: result.start_time, - creation_time: result.creation_time, - percentage: result.percentage_complete, - }; + // Save the document + self.job.analysis.save(function (err, result) { + self.job.analysis._isSaving = false; // Reset the saving flag - publisher.publish(self.channel, JSON.stringify(redis_packet)); - }); + if (err) { + winston.warn("Error saving analysis:", err); + return; + } + + // Prepare the redis packet + const redis_packet = { + type: "status update", + msg: data.msg, + phase: data.phase, + torque_id: result.torque_id, + start_time: result.start_time, + creation_time: result.creation_time, + percentage: result.percentage_complete, + }; + + // Publish the status update to the Redis channel + publisher.publish(self.channel, JSON.stringify(redis_packet)); + }); }); + // Routine status update self.server_socket.on("job created", function (data) { // Update document with status update diff --git a/package.json b/package.json index 3319c916..28f4bb2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datamonkey.js", - "version": "1.11.6", + "version": "1.12.0", "description": "A free public server for comparative analysis of sequence alignments using state-of-the-art statistical models.", "private": true, "author": { @@ -15,6 +15,9 @@ "format": "prettier 'src/**/*.{js,jsx}' 'app/**/*.{js,jsx}' 'lib/**/*.{js,jsx}' 'config/**/*.{js,jsx}' 'test/**/*.{js,jsx}' --write", "precommit": "pretty-quick --staged" }, + "engines": { + "node": ">=23.0.0" + }, "repository": { "type": "git", "url": "git://github.com/veg/datamonkey-js.git" diff --git a/yarn.lock b/yarn.lock index 3e6cbd1a..386a74cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6774,11 +6774,6 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -export-to-csv@^0.2.1: - version "0.2.2" - resolved "https://registry.yarnpkg.com/export-to-csv/-/export-to-csv-0.2.2.tgz#201ee08453dfb0d07792ee5e01fda48e4ff472ce" - integrity sha512-KHExLOjF2yvo8JU8Sv+5RuJAHzP1TpFvUgnWn8ex7zBrv1ZsABJAOpvG1RNRRWr1spYpDJmBBaR5/cV/8aBQSw== - export-to-csv@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/export-to-csv/-/export-to-csv-1.4.0.tgz#03fb42a4a4262cd03bde57a7b9bcad115149cf4b" @@ -9612,12 +9607,6 @@ locate-path@^7.1.0: dependencies: p-locate "^6.0.0" -lodash-es@^4.17.15: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" - integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== - - lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" @@ -10208,8 +10197,7 @@ module-deps@^6.2.3: through2 "^2.0.0" xtend "^4.0.0" - -moment@^2.30.1: +moment@^2.29.4, moment@^2.30.1: version "2.30.1" resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==