Skip to content

Instantly share code, notes, and snippets.

@scattered-code
Created January 6, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scattered-code/b16817bb515880a0202229d86841234e to your computer and use it in GitHub Desktop.
Save scattered-code/b16817bb515880a0202229d86841234e to your computer and use it in GitHub Desktop.
using (var session = documentStore.OpenSession())
{
session.Advanced.MaxNumberOfRequestsPerSession = int.MaxValue;
SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
await GetDocumentsFromDatabase(session).AsyncParallelForEach(async entry => {
Console.WriteLine($"Processing entry '{entry.Id}'");
}, 20, TaskScheduler.FromCurrentSynchronizationContext()
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment