This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
import {
|
||||
getStatsConfig,
|
||||
updateStatsConfig,
|
||||
setPeerStatsInterest,
|
||||
getStatsFilePath,
|
||||
STATS_LIMITS,
|
||||
} from '../services/stats.js'
|
||||
@@ -210,6 +211,21 @@ export function registerSystemHandlers(session) {
|
||||
return { success: true, config }
|
||||
})
|
||||
|
||||
/**
|
||||
* Client declares whether it needs live fleet stats for the current UI view.
|
||||
* Server only opens Docker stats streams while ≥1 peer has active interest.
|
||||
*/
|
||||
session.respond(
|
||||
'setStatsInterest',
|
||||
async (args = {}) => {
|
||||
const active = args.active === true || args.active === 1 || args.active === '1'
|
||||
const view = args.view != null ? String(args.view) : undefined
|
||||
const config = setPeerStatsInterest(session.id, active, { view })
|
||||
return { success: true, active, config }
|
||||
},
|
||||
{ hot: true }
|
||||
)
|
||||
|
||||
session.respond('listSchedules', async () => {
|
||||
return { success: true, schedules: listSchedules() }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user