I am creating a module for Drupal 7 that implements the hook_block_view. I make a call to watchdog in the hook method and I noticed (while debugging) that the the watchdog method is firing three times per page refresh. Is this normal, or is it something I should be worried about. Since each call to the method makes a database query it seems that this could result in a performance hit.
1 Answer
It gets called everytime the block is rendered. Truthfully, that is a bit wasteful since the params it is passed are the same. Still, in the normal block system, each block only loads once (i.e. it can only be in one region). This makes the logic forgivable, but yeah, it should be cached. You can of course cache it yourself in your hook_block_view implementation.
Disclaimer: I am drunk.