Skip to content

[Enhancement] Remove repeat check #3500

Open
@mawen12

Description

@mawen12

Issue Description

Type: enhancement

Describe what feature you want

The class ParamFlowSlot#entry method contains repeat code to check ParamFlowRule exists.
It is better to delete first check, because the method checkFlow is responsible for checking the relevant paramters.

class ParamFlowSlot {
    @Override
    public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode node, int count,
                      boolean prioritized, Object... args) throws Throwable {
        // first check
        if (!ParamFlowRuleManager.hasRules(resourceWrapper.getName())) {
            fireEntry(context, resourceWrapper, node, count, prioritized, args);
            return;
        }

        checkFlow(resourceWrapper, count, args);
        fireEntry(context, resourceWrapper, node, count, prioritized, args);
    }

    void checkFlow(ResourceWrapper resourceWrapper, int count, Object... args) throws BlockException {
        ...

        // second check
        if (!ParamFlowRuleManager.hasRules(resourceWrapper.getName())) {
            return;
        }
        ...
    }
}

Describe your initial design (if present)

The ParamFlowRule only need to be checked once.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions