Fix #2813: Ignore self dependency
Remove code duplication and add comments for readability
Merge pull request #2817 from eagletmt/fix-parallel-enqueue

Fix #2813: Ignore self dependency