private void updateOnlineUsersTtl() {
        Collection<UserSessionsManager> managers = userIdToSessionsManager.values();
        if (managers.isEmpty()) {
            return;
        }
        LongKeyGenerator userIds = collectOnlineUsersAndUpdateStatus(managers);
        try {
            userStatusService.updateOnlineUsersTtl(userIds, closeIdleSessionAfterSeconds)
                    .flatMap(nonexistentUserIds -> {
                        if (nonexistentUserIds.isEmpty()) {
                            return Mono.empty();
                        }
                        List<Mono<Integer>> closeLocalSessions =
                                new ArrayList<>(nonexistentUserIds.size());
                        for (Long nonexistentUserId : nonexistentUserIds) {
                            closeLocalSessions.add(sessionService
                                    .closeLocalSession(nonexistentUserId,
                                            SessionCloseStatus.DISCONNECTED_BY_OTHER_DEVICE)
                                    .onErrorMap(t -> new RuntimeException(
                                            "Caught an error while closing the session of the user: "
                                                    + nonexistentUserId)));
                        }
                        return Mono.whenDelayError(closeLocalSessions);
                    })
                    .block(DurationConst.ONE_MINUTE);
        } catch (Exception e) {
            throw new RuntimeException(
                    "Caught an error while refreshing online users' sessions in Redis",
                    e);
        }
    }
@author James Chen
@implNote Strategy Candidates: 1. Refresh the heartbeat info in Redis when a user sends a
          heartbeat request: It is a disaster for performance when there are many online users
          <p>
          2. Store heartbeat requests in a MPSC queue, and merge them into one Redis command and
          send them to Redis periodically: Waste memory and loss performance due to the
          operations on the MPSC queue
          <p>
          3. (Adopted) Do not store the requests, and just iterate over the original online user
          map to get a snapshot of the online users that need to update online status (go offline
          or refresh heartbeat)
turms-gateway/src/main/java/im/turms/gateway/domain/session/manager/HeartbeatManager.java