history optimizer to expire and moving the get node counts logic out of node_fsm