Wherever we accumulate exceptions for a CompoundError (e.g. add_artifacts) it should have a max size, e.g. 50. After that quit the loop and raise the exception.
This is to short circuit problems (e.g. communication with solr) instead of trying it thousands of times.
While we're at it, put it code after "ref = M.ArtifactReference.query.get(_id=ref_id)" to see if it's None. Log and continue.
Diff:
2nd part done (trivial); first part doesn't have a clean solution and only was a problem once