.......PS. [ZBX-8092] ported r46674 from 2.2 branch (code rearrangement so hosts are synced before items)