Skip to content

Commit 0908116

Browse files
committed
Fix mongodb index for GetRunnableInstances
1 parent 97974b2 commit 0908116

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ static void CreateIndexes(MongoPersistenceProvider instance)
9393
if (!indexesCreated)
9494
{
9595
instance.WorkflowInstances.Indexes.CreateOne(new CreateIndexModel<WorkflowInstance>(
96-
Builders<WorkflowInstance>.IndexKeys.Ascending(x => x.NextExecution),
97-
new CreateIndexOptions {Background = true, Name = "idx_nextExec"}));
96+
Builders<WorkflowInstance>.IndexKeys
97+
.Ascending(x => x.NextExecution)
98+
.Ascending(x => x.Status),
99+
new CreateIndexOptions {Background = true, Name = "idx_nextExec_v2"}));
98100

99101
instance.Events.Indexes.CreateOne(new CreateIndexModel<Event>(
100102
Builders<Event>.IndexKeys.Ascending(x => x.IsProcessed),

0 commit comments

Comments
 (0)