Repository: appsmithorg/appsmith
File: app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (Java)

Code before:
    }

    /**
     * Fetches the required Mono (action, datasource, and plugin) and makes actionExecution call to plugin
     *
     * @param executeActionDTO
     * @param executeActionMetaDTO
     * @return actionExecutionResult if query succeeds, error messages otherwise
     */
    @Override
    public Mono<ActionExecutionResult> executeAction(
            ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO) {
        // 1. Validate input parameters which are required for mustache replacements
        replaceNullWithQuotesForParamValues(executeActionDTO.getParams());

        String actionId = executeActionDTO.getActionId();
        AtomicReference<String> actionName = new AtomicReference<>();
        actionName.set("");

        // 2. Fetch the action from the DB and check if it can be executed
        Mono<ActionDTO> actionDTOMono = getValidActionForExecution(executeActionDTO, executeActionMetaDTO)
                .cache();

        // 3. Instantiate the implementation class based on the query type
        Mono<DatasourceStorage> datasourceStorageMono = getCachedDatasourceStorage(actionDTOMono, executeActionMetaDTO);
        Mono<Plugin> pluginMono = Mono.just(executeActionMetaDTO.getPlugin());
        Mono<PluginExecutor> pluginExecutorMono = pluginExecutorHelper.getPluginExecutor(pluginMono);

        // 4. Execute the query
        Mono<ActionExecutionResult> actionExecutionResultMono = getActionExecutionResult(
                executeActionDTO,
                actionDTOMono,
                datasourceStorageMono,
                pluginMono,
                pluginExecutorMono,
                executeActionMetaDTO.getHeaders());

        Mono<Map> editorConfigLabelMapMono = getEditorConfigLabelMap(datasourceStorageMono);

        return actionExecutionResultMono
                .zipWith(editorConfigLabelMapMono, (result, labelMap) -> {
                    if (TRUE.equals(executeActionDTO.getViewMode())) {
                        result.setRequest(null);
                    } else if (result.getRequest() != null
                            && result.getRequest().getRequestParams() != null) {
                        transformRequestParams(result, labelMap);
                    }
                    return result;
                })
                .map(result -> addDataTypesAndSetSuggestedWidget(result, executeActionDTO.getViewMode()))
                .onErrorResume(AppsmithException.class, error -> {

Review comment (performance):
@ApekshaBhosale can you add a check here, to only use plugin from executeActionMetaDTO if it is not null. 
If plugin is null, you can use it from getCachedPluginForActionExecution(datasourceStorageMono) only.

This is because we are setting plugin only from one of the callers of executeAction() function, but it is invoked from multiple places.

Code after:
                .map(plugin -> {
                    executeActionMetaDTO.setPlugin(plugin);
                    return plugin.getName() != null ? plugin.getName() : NONE;
                })
                .defaultIfEmpty(NONE)
                .flatMap(pluginName -> {
                    String name = (String) pluginName;
                    if (NONE.equals(name)) {
                        executeActionMetaDTO.setPlugin(null);
                    }
                    return executeActionDTOMono
                            .flatMap(executeActionDTO ->
                                    populateAndExecuteAction(executeActionDTO, executeActionMetaDTO))
                            .tag("plugin", name)
                            .name(ACTION_EXECUTION_SERVER_EXECUTION)
                            .tap(Micrometer.observation(observationRegistry));
                });
    }

    /**
     * Fetches the required Mono (action, datasource, and plugin) and makes actionExecution call to plugin
     *
     * @param executeActionDTO
     * @param executeActionMetaDTO
     * @return actionExecutionResult if query succeeds, error messages otherwise
     */
    @Override
    public Mono<ActionExecutionResult> executeAction(
            ExecuteActionDTO executeActionDTO, ExecuteActionMetaDTO executeActionMetaDTO) {
        // 1. Validate input parameters which are required for mustache replacements
        replaceNullWithQuotesForParamValues(executeActionDTO.getParams());

        String actionId = executeActionDTO.getActionId();
        AtomicReference<String> actionName = new AtomicReference<>();
        actionName.set("");

        // 2. Fetch the action from the DB and check if it can be executed
        Mono<ActionDTO> actionDTOMono = getValidActionForExecution(executeActionDTO, executeActionMetaDTO)
                .cache();

        // 3. Instantiate the implementation class based on the query type
        Mono<DatasourceStorage> datasourceStorageMono = getCachedDatasourceStorage(actionDTOMono, executeActionMetaDTO);
        Mono<Plugin> pluginMono = executeActionMetaDTO.getPlugin() != null
                ? Mono.just(executeActionMetaDTO.getPlugin())
                : getCachedPluginForActionExecution(datasourceStorageMono);
        Mono<PluginExecutor> pluginExecutorMono = pluginExecutorHelper.getPluginExecutor(pluginMono);

        // 4. Execute the query
        Mono<ActionExecutionResult> actionExecutionResultMono = getActionExecutionResult(
                executeActionDTO,
                actionDTOMono,