mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
stats: activePads & lastDisconnected stats
This commit is contained in:
parent
5f58ce14d6
commit
c969ae58c2
2 changed files with 19 additions and 0 deletions
|
@ -22,6 +22,7 @@
|
|||
|
||||
const log4js = require('log4js');
|
||||
const messageLogger = log4js.getLogger('message');
|
||||
const stats = require('../stats');
|
||||
|
||||
/**
|
||||
* Saves all components
|
||||
|
@ -77,6 +78,11 @@ exports.setSocketIO = (_socket) => {
|
|||
});
|
||||
|
||||
client.on('disconnect', () => {
|
||||
// store the lastDisconnect as a timestamp, this is useful if you want to know
|
||||
// when the last user disconnected. If your activePads is 0 and totalUsers is 0
|
||||
// you can say, if there has been no active pads or active users for 10 minutes
|
||||
// this instance can be brought out of a scaling cluster.
|
||||
stats.gauge('lastDisconnect', () => Date.now());
|
||||
// tell all components about this disconnect
|
||||
for (const i in components) {
|
||||
components[i].handleDisconnect(client);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue