Skip to content

Commit c527727

Browse files
#966 Poor configure/upsert SQL and websocket body causes memory spike. (#967)
* #966 Poor configure/upsert SQL and websocket body causes memory spike. * chore: bump version to 4.3.31-20260511 [version bump] --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent dc1cfe0 commit c527727

3 files changed

Lines changed: 19 additions & 16 deletions

File tree

API/Backend/Config/routes/configs.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -518,23 +518,23 @@ function upsert(req, res, next, cb, info) {
518518

519519
const forceClientUpdate = req.body?.forceClientUpdate || false;
520520

521-
Config.findAll({
521+
Config.max("version", {
522522
where: {
523523
mission: req.body.mission,
524524
},
525-
order: [["id", "DESC"]],
526525
})
527-
.then((missions) => {
528-
missions.every(function (mission, i) {
529-
if (hasVersion && missions[i].version == req.body.version) {
530-
versionConfig = missions[i].config;
531-
return false;
532-
}
533-
return true;
534-
});
535-
536-
if (missions && missions.length > 0) return missions[0].version;
537-
return -1;
526+
.then((maxVersion) => {
527+
const currentVersion = maxVersion == null || isNaN(maxVersion) ? -1 : maxVersion;
528+
529+
if (hasVersion) {
530+
return Config.findOne({
531+
where: { mission: req.body.mission, version: req.body.version },
532+
}).then((match) => {
533+
if (match) versionConfig = match.config;
534+
return currentVersion;
535+
});
536+
}
537+
return currentVersion;
538538
})
539539
.then((version) => {
540540
let configJSON;
@@ -658,7 +658,10 @@ function upsert(req, res, next, cb, info) {
658658
}
659659

660660
openWebSocket(
661-
req.body,
661+
{
662+
mission: req.body.mission,
663+
config: true,
664+
},
662665
{
663666
status: "success",
664667
mission: created.mission,

configure/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "configure",
3-
"version": "4.3.30-20260507",
3+
"version": "4.3.31-20260511",
44
"homepage": "./configure/build",
55
"private": true,
66
"dependencies": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mmgis",
3-
"version": "4.3.30-20260507",
3+
"version": "4.3.31-20260511",
44
"description": "A web-based mapping and localization solution for science operation on planetary missions.",
55
"homepage": "build",
66
"repository": {

0 commit comments

Comments
 (0)