Skip to content

Commit

Permalink
chore: move db calls to model definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogarim committed Dec 10, 2024
1 parent 9661ea3 commit b9c20d0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions apps/meteor/ee/server/startup/presence.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Presence } from '@rocket.chat/core-services';
import { id as instanceId } from '@rocket.chat/instance-status';
import { InstanceStatus } from '@rocket.chat/models';
import { InstanceStatus } from '@rocket.chat/instance-status';
import { InstanceStatus as InstanceStatusModel } from '@rocket.chat/models';
import { Accounts } from 'meteor/accounts-base';
import { Meteor } from 'meteor/meteor';
import { throttle } from 'underscore';

// update connections count every 30 seconds
const updateConns = throttle(function _updateConns() {
const nodeId = instanceId();
void InstanceStatus.updateConnections(nodeId, Meteor.server.sessions.size);
void InstanceStatusModel.updateConnections(InstanceStatus.id(), Meteor.server.sessions.size);
}, 30000);

Meteor.startup(() => {
Expand Down

0 comments on commit b9c20d0

Please sign in to comment.