From 4b066c639fdcd8efa2422f6474d8cdb87d527922 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 13 Sep 2023 21:37:41 -0600 Subject: [PATCH 1/4] Move queue-timeout setting to CE and remove dependency on waiting queue --- apps/meteor/package.json | 2 +- stats.mjs | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 stats.mjs diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 4b4d1275656e..ba1728962c56 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -15,7 +15,7 @@ "scripts": { "start": "meteor", "build:ci": "METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor build --server-only", - "dev": "meteor --exclude-archs \"web.browser.legacy, web.cordova\"", + "dev": "meteor --inspect --exclude-archs \"web.browser.legacy, web.cordova\"", "dsv": "meteor npm run dev", "ha": "meteor npm run ha:start", "ms": "TRANSPORTER=${TRANSPORTER:-TCP} meteor npm run dev", diff --git a/stats.mjs b/stats.mjs new file mode 100644 index 000000000000..309427c109b5 --- /dev/null +++ b/stats.mjs @@ -0,0 +1,50 @@ +#!/usr/bin/env zx + +console.log("Fetching stats..."); + +const files = await globby(["**/*.{js,jsx,ts,tsx}"], { + onlyFiles: true, + followSymbolicLinks: false, + gitignore: true, +}); + +const stats = { ts: { count: 0, loc: 0 }, js: { count: 0, loc: 0, big: [] } }; + +for (const file of files) { + switch (path.extname(file)) { + case '.js': + case '.jsx': + stats.js.count++; + stats.js.loc += (await fs.readFile(file, 'utf-8')).split('\n').filter(s => Boolean(s.trim())).length; + const stat = await fs.stat(file); + + stats.js.big.unshift({ file, size: stat.size }); + + break; + + case '.ts': + case '.tsx': + stats.ts.count++; + stats.ts.loc += (await fs.readFile(file, 'utf-8')).split('\n').filter(s => Boolean(s.trim())).length; + break; + } +} + +console.log(" JavaScript files:", stats.js.count); +console.log(" TypeScript files:", stats.ts.count); +console.log(" Conversion:", (stats.ts.count / (stats.js.count + stats.ts.count) * 100).toFixed(2) + "%"); + +console.log(); + +console.log(" JavaScript LOCs:", stats.js.loc); +console.log(" TypeScript LOCs:", stats.ts.loc); +console.log(" Conversion:", (stats.ts.loc / (stats.js.loc + stats.ts.loc) * 100).toFixed(2) + "%"); + +console.log(); + +console.log(" JavaScript biggest files:"); + +stats.js.big.sort((a, b) => b.size - a.size).splice(10); +for (const { file, size } of stats.js.big) { + console.log(" ", file, "(" + (size / 1024).toFixed(2) + "kb)"); +} \ No newline at end of file From dde40356697378fd2820320b0ac579c876ab6db8 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 13 Sep 2023 21:39:45 -0600 Subject: [PATCH 2/4] Discard changes to apps/meteor/package.json --- apps/meteor/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/package.json b/apps/meteor/package.json index ba1728962c56..4b4d1275656e 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -15,7 +15,7 @@ "scripts": { "start": "meteor", "build:ci": "METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor build --server-only", - "dev": "meteor --inspect --exclude-archs \"web.browser.legacy, web.cordova\"", + "dev": "meteor --exclude-archs \"web.browser.legacy, web.cordova\"", "dsv": "meteor npm run dev", "ha": "meteor npm run ha:start", "ms": "TRANSPORTER=${TRANSPORTER:-TCP} meteor npm run dev", From 0e50c8d0a8af8ea46ad1c15b17ada348fed73bc7 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 13 Sep 2023 21:39:51 -0600 Subject: [PATCH 3/4] Discard changes to stats.mjs --- stats.mjs | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 stats.mjs diff --git a/stats.mjs b/stats.mjs deleted file mode 100644 index 309427c109b5..000000000000 --- a/stats.mjs +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zx - -console.log("Fetching stats..."); - -const files = await globby(["**/*.{js,jsx,ts,tsx}"], { - onlyFiles: true, - followSymbolicLinks: false, - gitignore: true, -}); - -const stats = { ts: { count: 0, loc: 0 }, js: { count: 0, loc: 0, big: [] } }; - -for (const file of files) { - switch (path.extname(file)) { - case '.js': - case '.jsx': - stats.js.count++; - stats.js.loc += (await fs.readFile(file, 'utf-8')).split('\n').filter(s => Boolean(s.trim())).length; - const stat = await fs.stat(file); - - stats.js.big.unshift({ file, size: stat.size }); - - break; - - case '.ts': - case '.tsx': - stats.ts.count++; - stats.ts.loc += (await fs.readFile(file, 'utf-8')).split('\n').filter(s => Boolean(s.trim())).length; - break; - } -} - -console.log(" JavaScript files:", stats.js.count); -console.log(" TypeScript files:", stats.ts.count); -console.log(" Conversion:", (stats.ts.count / (stats.js.count + stats.ts.count) * 100).toFixed(2) + "%"); - -console.log(); - -console.log(" JavaScript LOCs:", stats.js.loc); -console.log(" TypeScript LOCs:", stats.ts.loc); -console.log(" Conversion:", (stats.ts.loc / (stats.js.loc + stats.ts.loc) * 100).toFixed(2) + "%"); - -console.log(); - -console.log(" JavaScript biggest files:"); - -stats.js.big.sort((a, b) => b.size - a.size).splice(10); -for (const { file, size } of stats.js.big) { - console.log(" ", file, "(" + (size / 1024).toFixed(2) + "kb)"); -} \ No newline at end of file From ffd5b880dad286d244b69dd56c604c8d634a3d4c Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 13 Sep 2023 21:40:28 -0600 Subject: [PATCH 4/4] commit the right files this time --- .../app/livechat-enterprise/server/settings.ts | 16 ---------------- apps/meteor/server/services/omnichannel/queue.ts | 2 +- apps/meteor/server/settings/omnichannel.ts | 10 ++++++++++ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/apps/meteor/ee/app/livechat-enterprise/server/settings.ts b/apps/meteor/ee/app/livechat-enterprise/server/settings.ts index d72e5364d101..0f21374ebf83 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/settings.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/settings.ts @@ -114,22 +114,6 @@ export const createSettings = async (): Promise => { modules: ['livechat-enterprise'], }); - await this.add('Omnichannel_queue_delay_timeout', 5, { - type: 'int', - group: 'Omnichannel', - section: 'Queue_management', - i18nLabel: 'Queue_delay_timeout', - i18nDescription: 'Time_in_seconds', - enableQuery: [ - { _id: 'Livechat_waiting_queue', value: true }, - { _id: 'Livechat_Routing_Method', value: { $ne: 'Manual_Selection' } }, - omnichannelEnabledQuery, - ], - enterprise: true, - invalidValue: 5, - modules: ['livechat-enterprise'], - }); - await this.add('Livechat_number_most_recent_chats_estimate_wait_time', 100, { type: 'int', group: 'Omnichannel', diff --git a/apps/meteor/server/services/omnichannel/queue.ts b/apps/meteor/server/services/omnichannel/queue.ts index 8bf5453587ce..684c10161a94 100644 --- a/apps/meteor/server/services/omnichannel/queue.ts +++ b/apps/meteor/server/services/omnichannel/queue.ts @@ -15,7 +15,7 @@ export class OmnichannelQueue implements IOmnichannelQueue { private queues: (string | undefined)[] = []; private delay() { - const timeout = settings.get('Omnichannel_queue_delay_timeout'); + const timeout = settings.get('Omnichannel_queue_delay_timeout') ?? 5; return timeout < 1 ? DEFAULT_RACE_TIMEOUT : timeout * 1000; } diff --git a/apps/meteor/server/settings/omnichannel.ts b/apps/meteor/server/settings/omnichannel.ts index 70fa92d347b8..fe5d27c1e677 100644 --- a/apps/meteor/server/settings/omnichannel.ts +++ b/apps/meteor/server/settings/omnichannel.ts @@ -534,6 +534,16 @@ export const createOmniSettings = () => enableQuery: [{ _id: 'Livechat_Routing_Method', value: 'External' }, omnichannelEnabledQuery], }); + await this.add('Omnichannel_queue_delay_timeout', 5, { + type: 'int', + group: 'Omnichannel', + section: 'Queue_management', + i18nLabel: 'Queue_delay_timeout', + i18nDescription: 'Time_in_seconds', + enableQuery: [{ _id: 'Livechat_Routing_Method', value: { $ne: 'Manual_Selection' } }, omnichannelEnabledQuery], + invalidValue: 5, + }); + await this.add('Livechat_Allow_collect_and_store_HTTP_header_informations', false, { type: 'boolean', group: 'Omnichannel',