Skip to content

Commit

Permalink
Fixing hangfire console
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofx committed Mar 4, 2024
1 parent 48ffbfb commit 9f7c42a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/Miru/Behaviors/Inactivable/InactivableDbSetExtensions.cs
@@ -1,5 +1,3 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Miru.Domain;
Expand Down
2 changes: 1 addition & 1 deletion src/Miru/Miru.csproj
Expand Up @@ -46,7 +46,7 @@
<!-- Queuing -->
<PackageReference Include="Hangfire.Core" Version="1.8.9" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.9" />
<PackageReference Include="Hangfire.Console" Version="1.4.3" />
<!-- <PackageReference Include="Hangfire.Console" Version="1.4.3" />-->
<PackageReference Include="Hangfire.Console.Extensions.Serilog" Version="2.0.0" />

<!-- Userfy -->
Expand Down
20 changes: 10 additions & 10 deletions src/Miru/QueueingRegistry.cs
@@ -1,4 +1,5 @@
using Hangfire;
using Hangfire.Console;
using Hangfire.Console.Extensions;
using Hangfire.Console.Extensions.Serilog;
using Microsoft.Extensions.DependencyInjection.Extensions;
Expand All @@ -17,7 +18,7 @@ public static class QueueingRegistry
.AddHangfire((sp, configuration) =>
{
configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
// .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings();
Expand All @@ -26,15 +27,14 @@ public static class QueueingRegistry
// .UseConsole registers routes into hangfire dashboard statically
// So in automated tests, when queue is registered in different ServiceProvider
// instances, UseConsole unfairly throws InvalidOperationException
// try
// {
// configuration
// .UseSerilogLogProvider()
// .UseColouredConsoleLogProvider();
// }
// catch (InvalidOperationException)
// {
// }
try
{
configuration.UseConsole();
configuration.UseColouredConsoleLogProvider();
}
catch (InvalidOperationException)
{
}
queuingBuilder?.Invoke(builder);
});
Expand Down

0 comments on commit 9f7c42a

Please sign in to comment.