Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when scheduling many jobs #29

Open
Arthurrochaa opened this issue Mar 15, 2021 · 0 comments
Open

Problem when scheduling many jobs #29

Arthurrochaa opened this issue Mar 15, 2021 · 0 comments

Comments

@Arthurrochaa
Copy link

Arthurrochaa commented Mar 15, 2021

Hi!

When trying to schedule many jobs at the same time, the following exception is bursting and consequently taking a long time to finalize the schedule:

MongoDB.Driver.Core.Operations.MongoBulkWriteOperationException em System.Private.CoreLib.dll

Follow the example of building jobs, the code snippet is inserted in a for loop, assigning the respective keys dynamically:

               var triggersAndJobs = new Dictionary<IJobDetail, IReadOnlyCollection<ITrigger>>();

                var jobBuilder = JobBuilder.Create<Scheduler>()
                    .WithIdentity(jobKey, GroupName)
                    .RequestRecovery(true))
                    .Build();

                var triggerCollection = new List<ITrigger>{ TriggerBuilder.Create()
                    .WithIdentity(triggerKey, GroupName)
                    .StartAt(time.ToUniversalTime())
                    .WithSchedule(SimpleScheduleBuilder.Create().WithMisfireHandlingInstructionFireNow())
                    .Build() };

                triggersAndJobs.Add(job, triggerCollection);
            
                await scheduler.ScheduleJobs(triggersAndJobs, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant