private Mono<Meeting> insertMeetingRecord(
            Date now,
            int retryTimes,
            @NotNull Long requesterId,
            @Nullable String name,
            @Nullable String intro,
            @Nullable String password,
            @NotNull Date startDate,
            @Nullable Long userId,
            @Nullable Long groupId,
            @Nullable ClientSession clientSession) {
        long time = now.getTime();
        Long id = switch (idType) {
            case DIGIT_9 -> generate9DigitId(time);
            case DIGIT_10 -> generate10DigitId(time);
        };
        Meeting meeting = new Meeting(
                id,
                requesterId,
                userId,
                groupId,
                name,
                intro,
                password,
                now,
                startDate,
                null,
                null);
        return meetingRepository.insert(meeting, clientSession)
                .thenReturn(meeting)
                .onErrorResume(DuplicateKeyException.class, e -> {
                    if (retryTimes >= 32) {
                        // If the error occurs, it means it is the time to extend the ID range.
                        return Mono.error(ResponseException.get(
                                ResponseStatusCode.SERVER_INTERNAL_ERROR,
                                "Generated a duplicate key: "
                                        + id
                                        + ", retry times exhausted. The ID range should be extended",
                                e));
                    }
                    // Note that it is fine and expected to generate some duplicate IDs,
                    // but the ID range should be extended if duplicate IDs are generated
                    // frequently.
                    LOGGER.warn("Generated a duplicate key: {}, retry times: {}",
                            id,
                            retryTimes,
                            e);
                    return insertMeetingRecord(now,
                            retryTimes + 1,
                            requesterId,
                            name,
                            intro,
                            password,
                            startDate,
                            userId,
                            groupId,
                            clientSession);
                });
    }
Use {@link SecureRandom} because users usually input meeting IDs to join meetings, so we
should make sure they are unpredictable.
turms-service/src/main/java/im/turms/service/domain/conference/service/ConferenceService.java