ActivityQueueService: heavy queue load

The performance of this can become poor when there is a lot of scheduled activities, for example when clearing a M2M relation, many Remove activities are scheduled

As it's in a thread, it doesn't block the responsiveness of the app, but it can delay the queue

Solutions could be

  • sending a Clear activity instead of many removes. But this would be an extension of the Activity Vocabulary
  • storing the target/origin id/name on the Activity model would save some evaluation time and clean up the code. I will do this if there's no reason not to? (redundant)
  • currently the target/origin is sent with the target object, and the receiver figures out which relation this is. If we were specific about the collection (#228), we wouldn't need to compare objects for add/remove activities
  • maybe there's a way to do it in the m2m_changed signal receiver which I'm not seeing
  • I haven't looked into the serializer code which clears the relation before adding to it

Please see this comment on the MR for code context: !160 (comment 38216)

Edited by Calum Mackervoy