Skip to content

campaigns: Dedupe priority items

Administrator requested to merge syncer-no-heap into master

Created by: ryanslade

This PR follows the original design but fixes the possibility of the same changeset getting queued up more than once in the priority channel.

It also makes sure that priority items are always run before non priority. Previously the select statement would pick randomly between scheduled and high priority items.

I also tried a different design using a heap which can be seen here: https://github.com/sourcegraph/sourcegraph/pull/8769

Overall I think this version that follows the original design is easier to understand. The heap implementation had too many mutex's for my liking and it was difficult to deal with handling priority requests cleanly because a request could come in for the currently pending item. As it had already been "popped" from the heap it's priority would not be modified so extra logic was needed in the main select loop to handle this.

Merge request reports

Loading