why is hook_access_node running three times? I'm working on a custom node access module. For this I'm working with hook_node_access hook (for the first time).
I want visitors to be able to view a node only when they are looking at them from the right domain. For this I have a content type page, in this content type I created a field field_domain.
Now I create a two nodes, Node A with field_domain value d9-a.lcl and Node B with field_domain value d9-b.lcl.
Now I wanted to create the module based on the this tutorial. But before this I created a simple check to see if I can get the value from the field and current domain. So I wrote this:
function hook_access_node_access(NodeInterface $node, $op, $account)
{
    $type = $node-&gt;bundle();
    if ($type == 'page') {
        $currentDomain = $_SERVER['SERVER_NAME'];
        $readerDomain = $node-&gt;field_domain-&gt;value;
        dpm($node-&gt;id());
        dpm('Current domain: ' . $currentDomain);
        dpm('Pages domain: ' . $readerDomain);
    }
}

Now going to Node B from domain d9-b.lcl made me expect to see three values. And the values I wanted to see are there but they get returned three times.

So for some reason the hook is called three times and I can't figure out why. Is it normal that this hook is called three times? And if it is is there a better way to do what I want?
Yes it’s perfectly usual for a node access hook to be hit multiple times in one request, check the $op parameter to see what you’re dealing with each time.
Checks may be done for different $op values like view,update and delete.
(Answer from @Clive in comments, posted here as answer after his advice. Please see question's comments.)