For those people for whom running node_access_rebuild function using drush is not working.
I'm not very familiar with drush internals, but the code
drush php-eval 'node_access_rebuild();' won't trigger batch processing. At least on the next drush/drupal versions (9.2.8, 10.6.1).
The thing is
node_access_rebuild function do not call batch processing immediaetly.
What worked for me is writing drush script to call batch processing explicitly:
// filename: rebuildPermissions.drush.php
// based on topic https://www.drupal.org/node/873132
node_access_rebuild($batch_mode = TRUE);
$batch =& batch_get();
$batch['progressive'] = FALSE;
and then just run it:
drush scr rebuildPermissions.drush.php
But in the end of the day I've used
node_access_rebuild_progressive module for my needs and rebuilt 12K rules and 92K nodes in 5 minutes using drush.