Skip to content

Commit

Permalink
perf: 添加变量存储定时器 01-11
Browse files Browse the repository at this point in the history
  • Loading branch information
forhumility committed Jan 11, 2024
1 parent 52e5dc0 commit 186e356
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/bemfa-mqtt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { IStatusObserver } from "./../lib/bemfa";
/**
* @Author : Humility
* @Date : 2023-07-13 11:11:43
* @LastEditTime : 2023-07-25 11:16:03
* @LastEditors : LST-Public
* @LastEditTime : 2024-01-11 16:57:43
* @LastEditors : Humility
* @FilePath : \humble-switch-bemfa\src\utils\bemfa-mqtt.ts
* @Description :
*/
Expand All @@ -20,6 +20,7 @@ export class BemfaMqtt extends events.EventEmitter implements IStatusObserver {
options: IClientOptions;
computerInfos: Array<ComputerInfo> = new Array<ComputerInfo>();
computerList: Array<Computer> = new Array<Computer>();
pollingInterval: NodeJS.Timer;

constructor(bemfaConf: BemfaInfo, devInfos: Array<ComputerInfo>) {
super();
Expand Down Expand Up @@ -100,8 +101,8 @@ export class BemfaMqtt extends events.EventEmitter implements IStatusObserver {
* @description: 电脑状态轮询(默认10分钟更新一次设备状态)
*/
computerStatusPolling(minute = 10) {
setInterval(() => {
console.log(new Date(), `更新设备状态...`);
this.pollingInterval = setInterval(() => {
// console.log(new Date(), `更新设备状态...`);
this.computerList.forEach((cmp) => {
cmp.updateStatus();
});
Expand Down

0 comments on commit 186e356

Please sign in to comment.