Skip to content

Commit e8d6195

Browse files
author
Richard Russell
committed
feat(Winton.Extensions.Threading.Actor): allow scheduler to enqueue work without suppressed transaction scope wrapper
1 parent 170c386 commit e8d6195

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Winton.Extensions.Threading.Actor/ActorScheduleOptions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public enum ActorScheduleOptions
2525
/// responsive and should not block on work) this would never be used. However, one use case might be if an actor
2626
/// were being used as a "single-threaded" work slave for another actor.
2727
/// </summary>
28-
WorkIsLongRunning = 2
28+
WorkIsLongRunning = 2,
29+
/// <summary>
30+
/// Specifies that the work to be done will not be wrapped within a block to suppress ambient transaction scope.
31+
/// </summary>
32+
NoSuppressTransactionScope = 4,
2933
}
3034
}

Winton.Extensions.Threading.Actor/Internal/ActorWorkScheduler.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,19 @@ private async Task Schedule(Func<Task> enqueuer, TimeSpan interval, ActorSchedul
8383

8484
private static ActorEnqueueOptions GetEnqueueOptions(ActorScheduleOptions actorScheduleOptions)
8585
{
86+
ActorEnqueueOptions result = ActorEnqueueOptions.Default;
87+
8688
if (actorScheduleOptions.HasFlag(ActorScheduleOptions.WorkIsLongRunning))
8789
{
88-
return ActorEnqueueOptions.WorkIsLongRunning;
90+
result |= ActorEnqueueOptions.WorkIsLongRunning;
8991
}
90-
else
92+
93+
if (actorScheduleOptions.HasFlag(ActorScheduleOptions.NoSuppressTransactionScope))
9194
{
92-
return ActorEnqueueOptions.Default;
95+
result |= ActorEnqueueOptions.NoSuppressTransactionScope;
9396
}
97+
98+
return result;
9499
}
95100
}
96101
}

0 commit comments

Comments
 (0)