~xdavidwu/uptime-monitor

b6eaefbc83343a30f22fa3a2017aaf719ae432e5 — xdavidwu 2 years ago 15fffe8
UptimeController: unserialize probe only when necessary
1 files changed, 1 insertions(+), 3 deletions(-)

M app/Http/Controllers/UptimeController.php
M app/Http/Controllers/UptimeController.php => app/Http/Controllers/UptimeController.php +1 -3
@@ 17,8 17,6 @@ class UptimeController extends Controller
        $instances = ProbeInstance::all();
        $data = [];
        foreach ($instances as $instance) {
            $probe = unserialize($instance->probe);

            $raw_logs = $instance->logs()->where('created_at', '>=', $from)->orderBy('created_at')->get();
            $raw_index = 0;
            $raw_length = count($raw_logs);


@@ 49,7 47,7 @@ class UptimeController extends Controller
            }

            $data[] = [
                'title' => $instance->title ?? $probe->describe(),
                'title' => $instance->title ?? unserialize($instance->probe)->describe(),
                'logs' => $logs,
            ];
        }