Skip to content

Commit

Permalink
implement RETENTION_TIME
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleJake committed Oct 29, 2024
1 parent a205107 commit f183aff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[MONITOR]
OFFLINE_THRESHOLD = 600
DATA_TIMEOUT = 259200
RETENTION_TIME = 86400

[REDIS]
HOST = ''
Expand Down
2 changes: 1 addition & 1 deletion application/common/lib/SystemMonitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static public function setCollection($uuid, $data)
Cache::store('redis')->handler()
->zAdd("system_monitor:collection:$uuid", time(), $data);
Cache::store('redis')->handler()
->zRemRangeByScore("system_monitor:collection:$uuid", 0, time() - Env::get("MONITOR.DATA_TIMEOUT"));
->zRemRangeByScore("system_monitor:collection:$uuid", 0, time() - Env::get("MONITOR.RETENTION_TIME"));
Cache::store('redis')->handler()->expire("system_monitor:collection:$uuid", Env::get("MONITOR.DATA_TIMEOUT"));
return ['code' => 200, 'message' => "OK"];
} catch (Exception $e) {
Expand Down

0 comments on commit f183aff

Please sign in to comment.