Hi,
I have a console app that search a set of data from LF and Export them. I'm using the following code snnipet:
public void ExportDocuments(IEnumerable<LaserficheEntry> documents) { DocumentExporter documentExporter = new DocumentExporter(); documentExporter.IncludeAnnotations = true; documentExporter.BlackoutRedactions = true; documentExporter.PageFormat = DocumentPageFormat.Jpeg; documentExporter.CompressionQuality = 90; Parallel.ForEach(documents, document => { DocumentInfo documentInfo = Document.GetDocumentInfo(document.ToString(), laserficheSession); try { if (documentInfo.AllPages.GetTotalPageCount() > 0) { documentExporter.ExportPdf(documentInfo, documentInfo.AllPages, PdfExportOptions.IncludeText, documentSignerSettings.ExportedFilesFolder + documentInfo.Name + ".pdf"); Console.WriteLine("Documento exportado: " + document.Name); } } catch { Console.WriteLine("Error importing file " + document.Name); } }); }
This code makes use from Parallel.Foreach that starts threads behind the scenes and export the files. At some point of the code execution I'm getting an error "The current request could not be performed because there are too many existing operations running.[9035]. Besides reducing my calls do sdk api, what would be the best approach?
Thanks,
Best Regards, Caio Himmelsbach