1
0
mirror of https://github.com/bitwarden/server synced 2025-12-28 06:03:29 +00:00

Turn on file scoped namespaces (#2225)

This commit is contained in:
Justin Baur
2022-08-29 14:53:16 -04:00
committed by GitHub
parent 7c4521e0b4
commit 34fb4cca2a
1206 changed files with 73816 additions and 75022 deletions

View File

@@ -2,36 +2,35 @@
using Bit.Core.Settings;
using Quartz;
namespace Bit.Notifications.Jobs
namespace Bit.Notifications.Jobs;
public class JobsHostedService : BaseJobsHostedService
{
public class JobsHostedService : BaseJobsHostedService
public JobsHostedService(
GlobalSettings globalSettings,
IServiceProvider serviceProvider,
ILogger<JobsHostedService> logger,
ILogger<JobListener> listenerLogger)
: base(globalSettings, serviceProvider, logger, listenerLogger) { }
public override async Task StartAsync(CancellationToken cancellationToken)
{
public JobsHostedService(
GlobalSettings globalSettings,
IServiceProvider serviceProvider,
ILogger<JobsHostedService> logger,
ILogger<JobListener> listenerLogger)
: base(globalSettings, serviceProvider, logger, listenerLogger) { }
var everyFiveMinutesTrigger = TriggerBuilder.Create()
.WithIdentity("EveryFiveMinutesTrigger")
.StartNow()
.WithCronSchedule("0 */30 * * * ?")
.Build();
public override async Task StartAsync(CancellationToken cancellationToken)
Jobs = new List<Tuple<Type, ITrigger>>
{
var everyFiveMinutesTrigger = TriggerBuilder.Create()
.WithIdentity("EveryFiveMinutesTrigger")
.StartNow()
.WithCronSchedule("0 */30 * * * ?")
.Build();
new Tuple<Type, ITrigger>(typeof(LogConnectionCounterJob), everyFiveMinutesTrigger)
};
Jobs = new List<Tuple<Type, ITrigger>>
{
new Tuple<Type, ITrigger>(typeof(LogConnectionCounterJob), everyFiveMinutesTrigger)
};
await base.StartAsync(cancellationToken);
}
await base.StartAsync(cancellationToken);
}
public static void AddJobsServices(IServiceCollection services)
{
services.AddTransient<LogConnectionCounterJob>();
}
public static void AddJobsServices(IServiceCollection services)
{
services.AddTransient<LogConnectionCounterJob>();
}
}

View File

@@ -2,25 +2,24 @@
using Bit.Core.Jobs;
using Quartz;
namespace Bit.Notifications.Jobs
namespace Bit.Notifications.Jobs;
public class LogConnectionCounterJob : BaseJob
{
public class LogConnectionCounterJob : BaseJob
private readonly ConnectionCounter _connectionCounter;
public LogConnectionCounterJob(
ILogger<LogConnectionCounterJob> logger,
ConnectionCounter connectionCounter)
: base(logger)
{
private readonly ConnectionCounter _connectionCounter;
_connectionCounter = connectionCounter;
}
public LogConnectionCounterJob(
ILogger<LogConnectionCounterJob> logger,
ConnectionCounter connectionCounter)
: base(logger)
{
_connectionCounter = connectionCounter;
}
protected override Task ExecuteJobAsync(IJobExecutionContext context)
{
_logger.LogInformation(Constants.BypassFiltersEventId,
"Connection count for server {0}: {1}", Environment.MachineName, _connectionCounter.GetCount());
return Task.FromResult(0);
}
protected override Task ExecuteJobAsync(IJobExecutionContext context)
{
_logger.LogInformation(Constants.BypassFiltersEventId,
"Connection count for server {0}: {1}", Environment.MachineName, _connectionCounter.GetCount());
return Task.FromResult(0);
}
}