private void processPendingEnrichment(final EnrichmentContext context) { final PendingEnrichment pending=this.pendingRepository.pendingEnrichmentOfExecution(context.targetExecution().executionId()); if(pending!=null) { LOGGER.trace("{} enrichment request is already being undertaken by pending enrichment #{}",context,pending.id()); return; } final List<PendingEnrichment> potentialEnrichments=this.pendingRepository.findPendingEnrichments(context.repositoryLocation(),context.branchName(),context.commitId()); if(!potentialEnrichments.isEmpty()) { final PendingEnrichment delegate = potentialEnrichments.get(0); delegate.executions().add(context.targetExecution().executionId()); LOGGER.trace("{} enrichment request joins to pending enrichment #{}",context,delegate.id()); return; } final PendingEnrichment newPending=PendingEnrichment.newInstance(context.repositoryLocation(),context.branchName(),context.commitId()); newPending.executions().add(context.targetExecution().executionId()); this.pendingRepository.add(newPending); LOGGER.trace("{} creates {}",context,newPending); context.setPendingEnrichment(newPending); this.requestor.enqueueRequest(context); }