Skip to content

Commit

Permalink
[fix] SmallHeart
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeme committed Jan 19, 2021
1 parent 7a52a14 commit 5a7b0a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugin/SmallHeart.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SmallHeart
private static $hb_payload = []; // 心跳请求数据
private static $hb_headers = []; // 心跳请求头

private static $hb_count_total = 0;
private static $hb_count = 0; // 心跳次数 max 24
private static $hb_room_info = []; // 心跳带勋章房间信息

Expand All @@ -48,7 +49,7 @@ public static function run()
}
if (self::getLock() < time()) {
self::heartBeat();
if (self::$hb_count >= 200) {
if (self::$hb_count_total >= 200) {
self::resetVar(true);
self::setLock(self::timing(2));
} else {
Expand All @@ -66,12 +67,11 @@ private static function resetVar($reset_num = false)
{
self::$hb_payload = []; // 心跳请求数据
self::$hb_headers = []; // 心跳请求头

if ($reset_num) {
self::$hb_count = 0; // 心跳次数 max 24
self::$hb_count_total = 0;
}
self::$hb_room_info = []; // 心跳带勋章房间信息

self::$hb_count = 0; // 心跳次数 max 24
self::$heartbeat_interval = 60; // 跳变时间
}

Expand Down Expand Up @@ -140,6 +140,7 @@ private static function heartBeat()
return;
}
self::$hb_count += 1;
self::$hb_count_total +=1;
self::$hb_payload = $e_data['payload'];
self::$hb_headers = $e_data['headers'];
return;
Expand All @@ -150,6 +151,7 @@ private static function heartBeat()
self::resetVar();
return;
}
self::$hb_count_total +=1;
self::$hb_count += 1;
}

Expand Down

0 comments on commit 5a7b0a4

Please sign in to comment.