fixes #8565 - only get unique, unused message/source IDs to speed up expiry