Skip to content

Commit 0ee1811

Browse files
authored
Refactored Discord Notifications to fix threshold notifications (alexjustesen#1254)
1 parent a19205c commit 0ee1811

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/Listeners/Threshold/AbsoluteListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ protected function discordChannel(ResultCreated $event): void
233233
$failedThresholds = []; // Initialize an array to keep track of failed thresholds
234234

235235
// Check Download threshold
236-
if ($this->thresholdSettings->absolute_download > 0 && absoluteDownloadThresholdFailed($this->thresholdSettings->absolute_download, $event->result->downloadBits)) {
237-
$failedThresholds['Download'] = ($event->result->downloadBits / 1000000).' (Mbps)';
236+
if ($this->thresholdSettings->absolute_download > 0 && absoluteDownloadThresholdFailed($this->thresholdSettings->absolute_download, $event->result->download)) {
237+
$failedThresholds['Download'] = toBits(convertSize($event->result->download), 2).' Mbps';
238238
}
239239

240240
// Check Upload threshold
241-
if ($this->thresholdSettings->absolute_upload > 0 && absoluteUploadThresholdFailed($this->thresholdSettings->absolute_upload, $event->result->uploadBits)) {
242-
$failedThresholds['Upload'] = ($event->result->uploadBits / 1000000).' (Mbps)';
241+
if ($this->thresholdSettings->absolute_upload > 0 && absoluteUploadThresholdFailed($this->thresholdSettings->absolute_upload, $event->result->upload)) {
242+
$failedThresholds['Upload'] = toBits(convertSize($event->result->upload), 2).' Mbps';
243243
}
244244

245245
// Check Ping threshold

0 commit comments

Comments
 (0)