mirror of
https://github.com/bitwarden/server
synced 2025-12-25 20:53:16 +00:00
Revert filescoped (#2227)
* Revert "Add git blame entry (#2226)" This reverts commit239286737d. * Revert "Turn on file scoped namespaces (#2225)" This reverts commit34fb4cca2a.
This commit is contained in:
@@ -2,35 +2,36 @@
|
||||
using Bit.Core.Settings;
|
||||
using Quartz;
|
||||
|
||||
namespace Bit.Notifications.Jobs;
|
||||
|
||||
public class JobsHostedService : BaseJobsHostedService
|
||||
namespace Bit.Notifications.Jobs
|
||||
{
|
||||
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 class JobsHostedService : BaseJobsHostedService
|
||||
{
|
||||
var everyFiveMinutesTrigger = TriggerBuilder.Create()
|
||||
.WithIdentity("EveryFiveMinutesTrigger")
|
||||
.StartNow()
|
||||
.WithCronSchedule("0 */30 * * * ?")
|
||||
.Build();
|
||||
public JobsHostedService(
|
||||
GlobalSettings globalSettings,
|
||||
IServiceProvider serviceProvider,
|
||||
ILogger<JobsHostedService> logger,
|
||||
ILogger<JobListener> listenerLogger)
|
||||
: base(globalSettings, serviceProvider, logger, listenerLogger) { }
|
||||
|
||||
Jobs = new List<Tuple<Type, ITrigger>>
|
||||
public override async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
new Tuple<Type, ITrigger>(typeof(LogConnectionCounterJob), everyFiveMinutesTrigger)
|
||||
};
|
||||
var everyFiveMinutesTrigger = TriggerBuilder.Create()
|
||||
.WithIdentity("EveryFiveMinutesTrigger")
|
||||
.StartNow()
|
||||
.WithCronSchedule("0 */30 * * * ?")
|
||||
.Build();
|
||||
|
||||
await base.StartAsync(cancellationToken);
|
||||
}
|
||||
Jobs = new List<Tuple<Type, ITrigger>>
|
||||
{
|
||||
new Tuple<Type, ITrigger>(typeof(LogConnectionCounterJob), everyFiveMinutesTrigger)
|
||||
};
|
||||
|
||||
public static void AddJobsServices(IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<LogConnectionCounterJob>();
|
||||
await base.StartAsync(cancellationToken);
|
||||
}
|
||||
|
||||
public static void AddJobsServices(IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<LogConnectionCounterJob>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,25 @@
|
||||
using Bit.Core.Jobs;
|
||||
using Quartz;
|
||||
|
||||
namespace Bit.Notifications.Jobs;
|
||||
|
||||
public class LogConnectionCounterJob : BaseJob
|
||||
namespace Bit.Notifications.Jobs
|
||||
{
|
||||
private readonly ConnectionCounter _connectionCounter;
|
||||
|
||||
public LogConnectionCounterJob(
|
||||
ILogger<LogConnectionCounterJob> logger,
|
||||
ConnectionCounter connectionCounter)
|
||||
: base(logger)
|
||||
public class LogConnectionCounterJob : BaseJob
|
||||
{
|
||||
_connectionCounter = connectionCounter;
|
||||
}
|
||||
private readonly 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user