This moves the code used for processing commits from GitPushService to
its own Sidekiq worker: ProcessCommitWorker.
Using a Sidekiq worker allows us to process multiple commits in
parallel. This in turn will lead to issues being closed faster and cross
references being created faster. Furthermore by isolating this code into
a separate class it's easier to test and maintain the code.
The new worker also ensures it can efficiently check which issues can be
closed, without having to run numerous SQL queries for every issue.
This fixes email threading in Mail.app, that doesn't like when a thread
doesn't have stable recipients.
For instance, here is a possible sender-recipient combinations before:
From: A
To: Me
New issue
From: B
To: Me
Reply on new issue
From: A
To: Me
Another reply
Mail.app doesn't see B as a participant to the original email thread,
and decides to break the thread: it will group all messages from A
together, and separately all messages from B.
This commit makes the thread look like this:
From: A
To: gitlab/project
Cc: Me
New issue
From: B
To: gitlab/project
Cc: Me
Reply on new issue
From: A
To: gitlab/project
Cc: Me
Another reply
Mail.app sees a common recipient, and group the thread correctly.