code: func (ca *CertificateAuthorityImpl) integrateOrphan() error {
  	item, err := ca.orphanQueue.Peek()
  	if err != nil {
  		if err == goque.ErrEmpty {
  			return goque.ErrEmpty
  		}
  		return fmt.Errorf("failed to peek into orphan queue: %s", err)
  	}
  	var orphan orphanedCert
  	if err = item.ToObject(&orphan); err != nil {
  		return fmt.Errorf("failed to marshal orphan: %s", err)
  	}
  	cert, err := x509.ParseCertificate(orphan.DER)
  	if err != nil {
  		return fmt.Errorf("failed to parse orphan: %s", err)
  	}
  	issued := cert.NotBefore.Add(-ca.backdate)
  	_, err = ca.sa.AddCertificate(context.Background(), orphan.DER, orphan.RegID, orphan.OCSPResp, &issued)
  	if err != nil && !berrors.Is(err, berrors.Duplicate) {
  		return fmt.Errorf("failed to store orphaned certificate: %s", err)
  	}
  	if _, err = ca.orphanQueue.Dequeue(); err != nil {
  		return fmt.Errorf("failed to dequeue integrated orphaned certificate: %s", err)
  	}
  	return nil
  }
docs: // integrateOrpan removes an orphan from the queue and adds it to the database. The
  // item isn't dequeued until it is actually added to the database to prevent items from
  // being lost if the CA is restarted between the item being dequeued and being added to
  // the database. It calculates the issuance time by subtracting the backdate period from
  // the notBefore time.