diff --git a/.github/workflows/test-trigger.yml b/.github/workflows/test-trigger.yml index fabd95657..f31f215a1 100644 --- a/.github/workflows/test-trigger.yml +++ b/.github/workflows/test-trigger.yml @@ -6,11 +6,10 @@ name: Trigger E2E tests on: push: - branches: [ staging, 2025.9-rc, 2025.9-test ] + branches: [ staging, 2025.12-rc, 2025.12-test ] jobs: trigger-tests: - if: github.ref_name == 'staging' runs-on: ubuntu-latest steps: - name: Trigger E2E test run (local) @@ -19,9 +18,9 @@ jobs: if [ "$branch" = "staging" ]; then event_type="trigger-e2e-tests-staging" - elif [ "$branch" = "2025.9-rc" ]; then + elif [ "$branch" = "2025.12-rc" ]; then event_type="trigger-e2e-tests-rc" - elif [ "$branch" = "2025.9-test" ]; then + elif [ "$branch" = "2025.12-test" ]; then event_type="trigger-e2e-tests-test" fi diff --git a/lib/api.js b/lib/api.js index eec25ea35..bf5c71e51 100644 --- a/lib/api.js +++ b/lib/api.js @@ -173,16 +173,16 @@ nThen(function (w) { let oldUsers = Env.maxConcurrentRegUsers || 0; let stats = Server.getSessionStats(); let chans = Server.getActiveChannelCount(); - let reg = 0; - let regKeys = []; - Object.keys(Env.netfluxUsers).forEach(id => { - let keys = Env.netfluxUsers[id]; - let key = Object.keys(keys || {})[0]; - if (!key) { return; } - if (regKeys.includes(key)) { return; } - reg++; - regKeys.push(key); - }); + + const map = Env.netfluxUsers; + // Extract public key from each ws connection + let regKeys = Object.keys(map).map(id => { + return Object.keys(map[id] || {})[0]; + }).filter(Boolean); + // Convert to set to get only unique values + let regSet = new Set(regKeys); + const reg = regSet.size; + Env.maxConcurrentWs = Math.max(oldWs, stats.total); Env.maxConcurrentUniqueWs = Math.max(oldUniqueWs, stats.unique); Env.maxConcurrentRegUsers = Math.max(oldUsers, reg); @@ -194,9 +194,10 @@ nThen(function (w) { try { let users = Env.netfluxUsers || {}; let online = Server.getOnlineUsers() || []; + let onlineSet = new Set(online); let removed = 0; Object.keys(users).forEach(id => { - if (!online.includes(id)) { + if (!onlineSet.has(id)) { delete users[id]; removed++; } @@ -209,9 +210,10 @@ nThen(function (w) { let HK = require('./hk-utils'); let chans = Env.channel_cache || {}; let active = Server.getActiveChannels() || []; + let activeSet = new Set(active); let removed = 0; Object.keys(chans).forEach(id => { - if (!active.includes(id)) { + if (!activeSet.has(id)) { HK.dropChannel(Env, id); removed++; } diff --git a/lib/storage/file.js b/lib/storage/file.js index b6b42a1c1..76563d1e2 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -286,9 +286,9 @@ var closeChannel = function (env, channelName, cb) { } }; -var closeInactiveChannels = function (env, schedule, active) { +var closeInactiveChannels = function (env, schedule, activeSet) { Object.keys(env.channels).forEach(channelName => { - if (!active.includes(channelName)) { + if (!activeSet.has(channelName)) { schedule.ordered(channelName, function (next) { closeChannel(env, channelName, next); }); @@ -1473,8 +1473,8 @@ module.exports.create = function (conf, _cb) { closeChannel(env, channelName, Util.both(cb, next)); }); }, - closeInactiveChannels: function (active) { - closeInactiveChannels(env, schedule, active); + closeInactiveChannels: function (activeSet) { + closeInactiveChannels(env, schedule, activeSet); }, // write to a log file log: function (channelName, content, cb) { diff --git a/src/common/common-util.js b/src/common/common-util.js index c48bf809f..e3635e165 100644 --- a/src/common/common-util.js +++ b/src/common/common-util.js @@ -314,13 +314,7 @@ const factory = (NaclUtil) => { }; Util.deduplicateString = function (array) { - var a = array.slice(); - for(var i=0; i