Skip to content

Commit

Permalink
feat: use Task.Factory.StartNew
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Dec 31, 2023
1 parent 12ea935 commit 23f1d38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/GZCTF/Extensions/DatabaseSinkExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class DatabaseSink : ILogEventSink, IDisposable
public DatabaseSink(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
Task.Run(() => WriteToDatabase(_tokenSource.Token), _tokenSource.Token);
Task.Factory.StartNew(
() => WriteToDatabase(_tokenSource.Token),
_tokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
}

public void Dispose()
Expand Down

0 comments on commit 23f1d38

Please sign in to comment.