feature/IO-2742-redis - Checkpoint, All optimizations to prevent multiple requests to redis have been applied. Things like using lists for the Log Events, to getting and setting multiple values at the same time when given the chance.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -12,14 +12,15 @@ const CalcualteAllocations = require("./cdk-calculate-allocations").default;
|
||||
const InstanceMgr = require("../utils/instanceMgr").default;
|
||||
|
||||
const moment = require("moment-timezone");
|
||||
const { setSessionData, getSessionData } = require("../../server");
|
||||
const { setSessionData, getSessionData, getMultipleSessionData, setMultipleSessionData } = require("../../server");
|
||||
|
||||
const replaceSpecialRegex = /[^a-zA-Z0-9 .,\n #]+/g;
|
||||
|
||||
exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||
await setSessionData(socket.id, "logEvents", []);
|
||||
await setSessionData(socket.id, "recordid", jobid);
|
||||
await setSessionData(socket.id, "txEnvelope", txEnvelope);
|
||||
await setMultipleSessionData(socket.id, {
|
||||
recordid: jobid,
|
||||
txEnvelope
|
||||
});
|
||||
|
||||
try {
|
||||
await CdkBase.createLogEvent(socket, "DEBUG", `Received Job export request for id ${jobid}`);
|
||||
@@ -473,10 +474,12 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
|
||||
|
||||
async function InsertDmsVehicle(socket) {
|
||||
try {
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const txEnvelope = await getSessionData(socket.id, "txEnvelope");
|
||||
const DMSVid = await getSessionData(socket.id, "DMSVid");
|
||||
const DMSCust = await getSessionData(socket.id, "DMSCust");
|
||||
const { JobData, txEnvelope, DMSVid, DMSCust } = await getMultipleSessionData(socket.id, [
|
||||
"JobData",
|
||||
"txEnvelope",
|
||||
"DMSVid",
|
||||
"DMSCust"
|
||||
]);
|
||||
|
||||
const soapClientVehicleInsertUpdate = await soap.createClientAsync(CdkWsdl.VehicleInsertUpdate);
|
||||
|
||||
@@ -554,11 +557,13 @@ async function InsertDmsVehicle(socket) {
|
||||
async function UpdateDmsVehicle(socket) {
|
||||
try {
|
||||
const soapClientVehicleInsertUpdate = await soap.createClientAsync(CdkWsdl.VehicleInsertUpdate);
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const DMSVeh = await getSessionData(socket.id, "DMSVeh");
|
||||
const DMSCust = await getSessionData(socket.id, "DMSCust");
|
||||
const selectedCustomerId = await getSessionData(socket.id, "selectedCustomerId");
|
||||
const txEnvelope = await getSessionData(socket.id, "txEnvelope");
|
||||
const { JobData, DMSVeh, DMSCust, selectedCustomerId, txEnvelope } = await getMultipleSessionData(socket.id, [
|
||||
"JobData",
|
||||
"DMSVeh",
|
||||
"DMSCust",
|
||||
"selectedCustomerId",
|
||||
"txEnvelope"
|
||||
]);
|
||||
|
||||
let ids = [];
|
||||
|
||||
@@ -660,9 +665,11 @@ async function UpdateDmsVehicle(socket) {
|
||||
|
||||
async function InsertServiceVehicleHistory(socket) {
|
||||
try {
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const DMSVid = await getSessionData(socket.id, "DMSVid");
|
||||
const txEnvelope = await getSessionData(socket.id, "txEnvelope");
|
||||
const { JobData, DMSVid, txEnvelope } = await getMultipleSessionData(socket.id, [
|
||||
"JobData",
|
||||
"DMSVid",
|
||||
"txEnvelope"
|
||||
]);
|
||||
|
||||
const soapClientServiceHistoryInsert = await soap.createClientAsync(CdkWsdl.ServiceHistoryInsert);
|
||||
|
||||
@@ -713,8 +720,7 @@ async function InsertServiceVehicleHistory(socket) {
|
||||
|
||||
async function InsertDmsStartWip(socket) {
|
||||
try {
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const txEnvelope = await getSessionData(socket.id, "txEnvelope");
|
||||
const { JobData, txEnvelope } = await getMultipleSessionData(socket.id, ["JobData", "txEnvelope"]);
|
||||
|
||||
const soapClientAccountingGLInsertUpdate = await soap.createClientAsync(CdkWsdl.AccountingGLInsertUpdate);
|
||||
|
||||
@@ -799,9 +805,11 @@ async function InsertDmsBatchWip(socket) {
|
||||
}
|
||||
|
||||
async function GenerateTransWips(socket) {
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const DMSTransHeader = await getSessionData(socket.id, "DMSTransHeader");
|
||||
const txEnvelope = await getSessionData(socket.id, "txEnvelope");
|
||||
const { JobData, DMSTransHeader, txEnvelope } = await getMultipleSessionData(socket.id, [
|
||||
"JobData",
|
||||
"DMSTransHeader",
|
||||
"txEnvelope"
|
||||
]);
|
||||
|
||||
const allocations = await CalcualteAllocations(socket, JobData.id);
|
||||
const wips = [];
|
||||
@@ -921,8 +929,7 @@ async function GenerateTransWips(socket) {
|
||||
|
||||
async function PostDmsBatchWip(socket) {
|
||||
try {
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const DMSTransHeader = await getSessionData(socket.id, "DMSTransHeader");
|
||||
const { JobData, DMSTransHeader } = await getMultipleSessionData(socket.id, ["JobData", "DMSTransHeader"]);
|
||||
|
||||
const soapClientAccountingGLInsertUpdate = await soap.createClientAsync(CdkWsdl.AccountingGLInsertUpdate);
|
||||
|
||||
@@ -959,8 +966,7 @@ async function PostDmsBatchWip(socket) {
|
||||
|
||||
async function QueryDmsErrWip(socket) {
|
||||
try {
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const DMSTransHeader = await getSessionData(socket.id, "DMSTransHeader");
|
||||
const { JobData, DMSTransHeader } = await getMultipleSessionData(socket.id, ["JobData", "DMSTransHeader"]);
|
||||
|
||||
const soapClientAccountingGLInsertUpdate = await soap.createClientAsync(CdkWsdl.AccountingGLInsertUpdate);
|
||||
|
||||
@@ -993,8 +999,7 @@ async function QueryDmsErrWip(socket) {
|
||||
|
||||
async function DeleteDmsWip(socket) {
|
||||
try {
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const DMSTransHeader = await getSessionData(socket.id, "DMSTransHeader");
|
||||
const { JobData, DMSTransHeader } = await getMultipleSessionData(socket.id, ["JobData", "DMSTransHeader"]);
|
||||
|
||||
const soapClientAccountingGLInsertUpdate = await soap.createClientAsync(CdkWsdl.AccountingGLInsertUpdate);
|
||||
|
||||
@@ -1032,8 +1037,7 @@ async function DeleteDmsWip(socket) {
|
||||
async function MarkJobExported(socket, jobid) {
|
||||
await CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported for id ${jobid}`);
|
||||
|
||||
const JobData = await getSessionData(socket.id, "JobData");
|
||||
const transWips = (await getSessionData(socket.id, "transWips")) || [];
|
||||
const { JobData, transWips = [] } = await getMultipleSessionData(socket.id, ["JobData", "transWips"]);
|
||||
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user