Skip to content

Commit 43203ee

Browse files
authored
Merge pull request #969 from potatopeelings/master
Resolve #957, E11000 duplicate key error
2 parents df27a3c + 23f5f27 commit 43203ee

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/providers/WorkflowCore.Persistence.MongoDB/Services/MongoPersistenceProvider.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,16 @@ public async Task ScheduleCommand(ScheduledCommand command)
315315
{
316316
await ScheduledCommands.InsertOneAsync(command);
317317
}
318+
catch (MongoWriteException ex)
319+
{
320+
if (ex.WriteError?.Category == ServerErrorCategory.DuplicateKey)
321+
return;
322+
throw;
323+
}
318324
catch (MongoBulkWriteException ex)
319325
{
320326
if (ex.WriteErrors.All(x => x.Category == ServerErrorCategory.DuplicateKey))
321-
return;
327+
return;
322328
throw;
323329
}
324330
}

0 commit comments

Comments
 (0)