MCPcopy Create free account
hub / github.com/VirtualHotBar/NetMount / reupStats

Function reupStats

src/controller/stats/stats.ts:6–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { rclone_api_post } from '../../utils/rclone/request'
5
6async function reupStats() {
7 const stats = (await rclone_api_post('/core/stats')) as RcloneStats | undefined
8
9 if (!stats) {
10 return
11 }
12
13 let realSpeed: number = 0
14
15 if (stats.transferring && stats.transferring.length > 0) {
16 stats.transferring.forEach((item: RcloneTransferItem) => {
17 realSpeed += item.speed
18 })
19 }
20
21 rcloneInfo.stats = {
22 ...stats,
23 realSpeed: realSpeed || 0 /* stats.speed */,
24 }
25
26 //历史状态
27 rcloneStatsHistory.push(stats)
28
29 if (rcloneStatsHistory.length > 32) {
30 rcloneStatsHistory.splice(0, rcloneStatsHistory.length - 32)
31 }
32
33 hooks.upStats()
34}
35
36export { reupStats }

Callers 1

startUpdateContFunction · 0.90

Calls 1

rclone_api_postFunction · 0.90

Tested by

no test coverage detected