1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

Everywhere: Use ElapsedTimer::elapsed_time() for comparisons

Simplify a lot of uses of ElapsedTimer by converting the callers to
elapsed_time from elapsed, as the AK::Time returned is better for unit
conversions and comparisons against constants.
This commit is contained in:
Andrew Kaster 2023-01-01 22:38:53 -07:00 committed by Linus Groh
parent 4afa6e264c
commit ddf348daeb
8 changed files with 22 additions and 12 deletions

View file

@ -192,11 +192,13 @@ ConnectionToServerWrapper* ConnectionToServerInstances::get_instance_wrapper(Dep
void ConnectionToServerWrapper::on_crash()
{
using namespace AK::TimeLiterals;
show_crash_notification();
m_connection.clear();
static constexpr int max_crash_frequency_seconds = 10;
if (m_last_crash_timer.is_valid() && m_last_crash_timer.elapsed() / 1000 < max_crash_frequency_seconds) {
static constexpr Time max_crash_frequency = 10_sec;
if (m_last_crash_timer.is_valid() && m_last_crash_timer.elapsed_time() < max_crash_frequency) {
dbgln("LanguageServer crash frequency is too high");
m_respawn_allowed = false;