-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Change the import queue traits to take &mut self instead of &self #3058
Conversation
|
As a general rule I'd prefer to keep synchronization as low as possible. This allows for a more fine grained locking and less contention. E.g. in this case |
What I did in this PR is implement the Before this PR, the import queue was manipulating an The next goal (if possible) would be to make the import queue generic over its parameters instead of using |
Note: On ice because has to be based on top of #3049 in order to fix the tests. There's some overlap between this PR and #3049 and I'd rather wait for #3049 instead of fixing merge conflicts. However, the PR itself is ready for review.The
BlockImport,JustificationImport,FinalityProofImportandFinalityProofRequestBuildertraits have been modified to accept&mut selfinstead of&self.Additionally, they no longer get passed to the import queue by
Arcbut byBox.The only culprit is Aura, where I had to use an
Arc<Mutex<>>instead of aBox. Further clean ups should make it possible to remove thisArc<Mutex<>>.This PR doesn't achieve much. It is just some refactoring/cleanup. If there's no good reason to accept
&self, we should instead accept&mut self.Here's an untested Polkadot patch, but that I'm confident should work: