public StackPowerKickstarter(
			IScheduleCalculator scheduleCalculator,
			IBackgroundJobClient backgroundJobClient)
        {
            _scheduleCalculator = scheduleCalculator;
            _backgroundJobClient = backgroundJobClient;
        }
        public RefreshEverything(
			IRepository<AwsProfile> profileRepository,
			IBackgroundJobClient backgroundJobClient)
        {
            _profileRepository = profileRepository;
            _backgroundJobClient = backgroundJobClient;
        }
Пример #3
0
 public HistogramController(IHistogramRepository repository, IUserEventRepository userEventRepository, IGenerate<Histogram> generateHistogram, IFeatureRepository featureRepository, IBackgroundJobClient backgroundJobClient)
 {
     this.repository = repository;
     this.userEventRepository = userEventRepository;
     this.generateHistogram = generateHistogram;
     this.featureRepository = featureRepository;
     this.backgroundJobClient = backgroundJobClient;
 }
Пример #4
0
        public RecurringJobManager([NotNull] JobStorage storage, [NotNull] IBackgroundJobClient client)
        {
            if (storage == null) throw new ArgumentNullException("storage");
            if (client == null) throw new ArgumentNullException("client");

            _storage = storage;
            _client = client;
        }
Пример #5
0
 public TimeSeriesController(ApiDataContext context, ITimeSeriesRepository timeSeriesRepository, IUserEventRepository userEventRepository, IGenerate<TimeSeries> generateTimeSeries, IFeatureRepository featureRepository, IBackgroundJobClient backgroundJobClient)
 {
     this.context = context;
     this.timeSeriesRepository = timeSeriesRepository;
     this.userEventRepository = userEventRepository;
     this.generateTimeSeries = generateTimeSeries;
     this.featureRepository = featureRepository;
     this.backgroundJobClient = backgroundJobClient;
 }
        public RemoveStaleInstances(
			IAwsClientFactory awsClientFactory,
			IRepository<Instance> instanceRepository,
			IRepository<AwsProfile> profileRepository,
			IBackgroundJobClient backgroundJobClient)
            : base(profileRepository, awsClientFactory)
        {
            _instanceRepository = instanceRepository;
            _backgroundJobClient = backgroundJobClient;
        }
Пример #7
0
 public HangfireJobScheduler(
     ILog log,
     IJsonSerializer jsonSerializer,
     IBackgroundJobClient backgroundJobClient,
     IJobDefinitionService jobDefinitionService)
 {
     _log = log;
     _jsonSerializer = jsonSerializer;
     _backgroundJobClient = backgroundJobClient;
     _jobDefinitionService = jobDefinitionService;
 }
Пример #8
0
 public JobsHelper(IMetadataContext context, 
     IDownloadToStream downloader, 
     ICustomMetadataReader reader, IBackgroundJobClient client, 
     IPostNotificationSender sender)
 {
     _context = context;
     _downloader = downloader;
     _reader = reader;
     _client = client;
     _sender = sender;
 }
        public RecurringJobScheduler(
            [NotNull] JobStorage storage, 
            [NotNull] IBackgroundJobClient client, 
            [NotNull] IDateTimeProvider dateTimeProvider)
        {
            if (storage == null) throw new ArgumentNullException("storage");
            if (client == null) throw new ArgumentNullException("client");
            if (dateTimeProvider == null) throw new ArgumentNullException("dateTimeProvider");

            _storage = storage;
            _client = client;
            _dateTimeProvider = dateTimeProvider;
        }
        public ScheduledStopStack(
			IRepository<Stack> stackRepository,
			IRepository<Instance> instanceRepository,
			IInstancePower startInstances,
			IScheduleCalculator scheduleCalculator,
			IBackgroundJobClient backgroundJobClient)
        {
            _stackRepository = stackRepository;
            _instanceRepository = instanceRepository;
            _stopInstances = startInstances;
            _scheduleCalculator = scheduleCalculator;
            _backgroundJobClient = backgroundJobClient;
        }
        public AwsProfileController(
			IRepository<AwsProfile> profileRepository,
			IRepository<IPRange> ipRangeRepository,
			ICryptoProvider cryptoProvider,
			IBackgroundJobClient backgroundJobClient,
			IAuthenticatedUserClient userClient,
			IAwsClientFactory awsClientFactory)
        {
            _profileRepository = profileRepository;
            _ipRangeRepository = ipRangeRepository;
            _cryptoProvider = cryptoProvider;
            _backgroundJobClient = backgroundJobClient;
            _userClient = userClient;
            _awsClientFactory = awsClientFactory;
        }
Пример #12
0
        public RecurringJobScheduler(
            [NotNull] JobStorage storage,
            [NotNull] IBackgroundJobClient client,
            [NotNull] IScheduleInstantFactory instantFactory,
            [NotNull] IThrottler throttler)
        {
            if (storage == null) throw new ArgumentNullException("storage");
            if (client == null) throw new ArgumentNullException("client");
            if (instantFactory == null) throw new ArgumentNullException("instantFactory");
            if (throttler == null) throw new ArgumentNullException("throttler");

            _storage = storage;
            _client = client;
            _instantFactory = instantFactory;
            _throttler = throttler;
        }
Пример #13
0
        public void Setup()
        {
            _context = Mock.Of<IMetadataContext>();
            _scheduledImages = Mock.Of<DbSet<ScheduledImage>>();

            _downloader = Mock.Of<IDownloadToStream>();

            _metadataReader = Mock.Of<ICustomMetadataReader>();

            _client = Mock.Of<IBackgroundJobClient>();

            _postNotificationSender = Mock.Of<IPostNotificationSender>();

            Mock.Get(_scheduledImages).Setup(si => si.Find(It.IsAny<int>())).Returns(new ScheduledImage());
            Mock.Get(_context).Setup(c => c.ScheduledImages).Returns(_scheduledImages);
            Mock.Get(_metadataReader).Setup(m => m.ReadFromStream(It.IsAny<MemoryStream>())).Returns(new List<ImageMetadataTag>());
        }
Пример #14
0
 public RequestApiController(IMediator mediator, IBackgroundJobClient backgroundjobClient)
 {
     this.backgroundjobClient = backgroundjobClient;
     this.mediator            = mediator;
 }
Пример #15
0
 public FibonacciController(
     IBackgroundJobClient backgroundJobClient
     )
 {
     _backgroundJobClient = backgroundJobClient;
 }
 public JobEmailRepository(IDbContextResolver contextResolver,
                           IBackgroundJobClient backgroundJobClient) : base(contextResolver)
 {
     BackgroundJobClient = backgroundJobClient;
 }
Пример #17
0
 public SmsRequestController(IBackgroundJobClient jobClient, IChangeRequestStatus changeRequestStatus)
 {
     this.jobClient = jobClient;
     this.changeRequestStatus = changeRequestStatus;
 }
Пример #18
0
 public NewsletterService(IOptions <NewsletterServiceOptions> options, ILogger <NewsletterService> logger, IBackgroundJobClient jobClient)
 {
     newsletterListId = options.Value.MailChimpNewsletterListId;
     mailChimpManager = new MailChimpManager(new MailChimpOptions()
     {
         ApiKey = options.Value.MailChimpKey
     });
     this.jobClient = jobClient;
     this.logger    = logger;
 }
Пример #19
0
 public ChargerService(IOpenChargeHttpClient openChargeHttpClient, WorkDbContext workDbContext, IMapper mapper, IBackgroundJobClient backgroundJobClient)
 {
     _openChargeHttpClient = openChargeHttpClient;
     _workDbContext        = workDbContext;
     _mapper = mapper;
     _backgroundJobClient = backgroundJobClient;
 }
Пример #20
0
 public PaymentsController(IMediator mediator, IBackgroundJobClient backgroundJobClient)
 {
     _mediator            = mediator;
     _backgroundJobClient = backgroundJobClient;
 }
Пример #21
0
 public InitializationService(UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, IOptions <SeedOptions> seedOptions, ICrowdactionService crowdactionService, IImageService imageService, IBackgroundJobClient jobClient, ApplicationDbContext context, ILogger <InitializationService> logger)
 {
     this.userManager        = userManager;
     this.roleManager        = roleManager;
     this.seedOptions        = seedOptions.Value;
     this.crowdactionService = crowdactionService;
     this.imageService       = imageService;
     this.jobClient          = jobClient;
     this.context            = context;
     this.logger             = logger;
 }
 /// <summary>
 /// Changes state of a job with the specified <paramref name="jobId"/>
 /// to the <see cref="EnqueuedState"/>.
 /// </summary>
 ///
 /// <param name="client">An instance of <see cref="IBackgroundJobClient"/> implementation.</param>
 /// <param name="jobId">Identifier of job, whose state is being changed.</param>
 /// <returns>True, if state change succeeded, otherwise false.</returns>
 public static bool Requeue([NotNull] this IBackgroundJobClient client, string jobId)
 {
     return(Requeue(client, jobId, null));
 }
 public static string ContinueWith(this IBackgroundJobClient client, string parentId,
                                   [InstantHandle] Expression <Action> methodCall)
 {
     return(ContinueWith(client, parentId, methodCall, new EnqueuedState()));
 }
 public BackEndJobExampleNotification(IBackgroundJobClient backgroundJobClient)
 {
     this.backgroundJobClient = backgroundJobClient;
 }
Пример #25
0
 public BackgroundJobService(IBackgroundJobClient backgroundJobClient, IRecurringJobManager recurringJobManager)
 {
     _backgroundJobClient = backgroundJobClient;
     _recurringJobManager = recurringJobManager;
 }
 public CreateInstallmentMovementCommandHandler(IUserRepository repository, IAccountRepository accountRepository,
                                                ITransactionService transactionService, IBackgroundJobClient backgroundJobClient,
                                                IInstallmentMovementRepository installmentMovementRepository)
 {
     _userRepository                = repository;
     _accountRepository             = accountRepository;
     _transactionService            = transactionService;
     _backgroundJobClient           = backgroundJobClient;
     _installmentMovementRepository = installmentMovementRepository;
 }
Пример #27
0
 public HistogramController(ApiDataContext context, IFeatureRepository featureRepository, IBackgroundJobClient backgroundJobClient)
     : this(new HistogramRepository(context), new UserEventRepository(context), new GenerateFeatureDecorator<Histogram>(new GenerateHistogram(), featureRepository), featureRepository, backgroundJobClient)
 {
 }
Пример #28
0
 public DarknetService(ILogger <DarknetService> logger,
                       IBackgroundJobClient backgroundJobs)
 {
     _logger         = logger;
     _backgroundJobs = backgroundJobs;
 }
Пример #29
0
 public TestHangfireController(IBackgroundJobClient backgroundJob)
 {
     this.backgroundJob = backgroundJob;
 }
Пример #30
0
 public EntityHooksService(
     IBackgroundJobClient backgroundJobClient,
     IServiceProvider serviceProvider
     ) : base(backgroundJobClient, serviceProvider)
 {
 }
Пример #31
0
 public ContractTerminationController(IBackgroundJobClient jobClient)
 {
     _jobClient = jobClient;
 }
Пример #32
0
 public TestHangfireController(IBackgroundJobClient backgroundJob)
 {
     this.backgroundJob = backgroundJob;
 }
Пример #33
0
 public ApiController(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
        public static async Task <bool> HandlePatreonPledgeObject(PatreonObjectData?pledge, PatreonObjectData?user,
                                                                  string?rewardId, NotificationsEnabledDb database, IBackgroundJobClient jobClient)
        {
            if (pledge?.Attributes.AmountCents == null || user?.Attributes.Email == null)
            {
                throw new Exception("Invalid patron API object, missing key properties");
            }

            if (rewardId == null)
            {
                throw new Exception("Invalid patron API object, missing any reward id");
            }

            var pledgeCents = pledge.Attributes.AmountCents.Value;

            bool declined = !string.IsNullOrEmpty(pledge.Attributes.DeclinedSince);

            var email = user.Attributes.Email?.Trim();

            if (string.IsNullOrEmpty(email))
            {
                throw new Exception("Patron object has null email");
            }

            var patron = await database.Patrons.FirstOrDefaultAsync(p => p.Email == email);

            var username = user.Attributes.Vanity;

            if (string.IsNullOrWhiteSpace(username))
            {
                username = user.Attributes.FullName;
            }

            if (string.IsNullOrWhiteSpace(username))
            {
                // TODO: to resolve already used name conflicts the Id could be appended here
                username = user.Attributes.FirstName;
            }

            // Ensure no trailing spaces in patron names
            username = username?.Trim();

            if (string.IsNullOrWhiteSpace(username))
            {
                // Fallback to using the id if everything failed...
                username = $"Patron {user.Id}";
            }

            if (patron == null)
            {
                if (!declined)
                {
                    await database.LogEntries.AddAsync(new LogEntry()
                    {
                        Message = $"We have a new patron: {username}"
                    });

                    await database.Patrons.AddAsync(new Patron()
                    {
                        Username          = username,
                        Email             = email,
                        PledgeAmountCents = pledgeCents,
                        RewardId          = rewardId,
                        Marked            = true
                    });

                    return(true);
                }

                return(false);
            }

            patron.Marked = true;

            bool changes           = false;
            bool reapplySuspension = false;

            if (declined)
            {
                if (patron.Suspended != true)
                {
                    await database.LogEntries.AddAsync(new LogEntry()
                    {
                        Message = $"A patron ({patron.Id}) is now in declined state. Setting as suspended",
                    });

                    patron.Suspended       = true;
                    patron.SuspendedReason = "Payment failed on Patreon";
                    reapplySuspension      = true;

                    changes = true;
                }
            }
            else if (patron.RewardId != rewardId || patron.Username != username)
            {
                await database.LogEntries.AddAsync(new LogEntry()
                {
                    Message = $"A patron ({patron.Id}) has changed their reward or name",
                });

                patron.RewardId          = rewardId;
                patron.PledgeAmountCents = pledgeCents;
                patron.Username          = username;
                patron.Suspended         = false;
                reapplySuspension        = true;

                changes = true;
            }
            else if (patron.Suspended == true)
            {
                patron.Suspended  = false;
                reapplySuspension = true;

                changes = true;
            }

            if (reapplySuspension)
            {
                // Need to wait for this job as the changes aren't saved immediately
                jobClient.Schedule <CheckSSOUserSuspensionJob>(x => x.Execute(patron.Email, CancellationToken.None),
                                                               TimeSpan.FromSeconds(30));
            }

            return(changes);
        }
 public SendRequestConfirmationMessagesADayBeforeAnItineraryDate(AllReadyContext context, IBackgroundJobClient backgroundJob, ISmsSender smsSender)
 {
     this.context = context;
     this.backgroundJob = backgroundJob;
     this.smsSender = smsSender;
 }
 public SchedulerController(IMetadataContext context, IBackgroundJobClient backgroundJobClient, IPostNotificationSender postNotificationSender)
 {
     _context = context;
     _backgroundJobClient = backgroundJobClient;
     _postNotificationSender = postNotificationSender;
 }
Пример #37
0
 public RequestApiController(IMediator mediator, IBackgroundJobClient backgroundjobClient)
 {
     this.backgroundjobClient = backgroundjobClient;
     this.mediator = mediator;
 }
 public SendRequestConfirmationMessagesADayBeforeAnItineraryDate(AllReadyContext context, IBackgroundJobClient backgroundJob, ISmsSender smsSender)
 {
     this.context       = context;
     this.backgroundJob = backgroundJob;
     this.smsSender     = smsSender;
 }
 public RegistrationController(ILogger <RegistrationController> logger, IRegistrationStatus configuration,
                               ITokenVerifier csrfVerifier, NotificationsEnabledDb database, IBackgroundJobClient jobClient)
 {
     this.logger        = logger;
     this.configuration = configuration;
     this.csrfVerifier  = csrfVerifier;
     this.database      = database;
     this.jobClient     = jobClient;
 }
Пример #40
0
 public ApiRequestProcessedNotificationHandler(AllReadyContext context, IBackgroundJobClient backgroundJobClient)
 {
     this.context             = context;
     this.backgroundJobClient = backgroundJobClient;
 }
Пример #41
0
 public EntityFrameworkEventStore(EventsDbContext context, IBackgroundJobClient jobClient)
 {
     _context   = context;
     _jobClient = jobClient;
 }
Пример #42
0
 public JobFactory(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
 public StoredQueriesExecutionJob(IBackgroundJobClient backgroundJobClient, ILogger <StoredQueriesExecutionJob> logger, IRemoteAppDataService appDataService)
 {
     _backgroundJobClient = backgroundJobClient;
     _logger         = logger;
     _appDataService = appDataService;
 }
Пример #44
0
 public DeleteFileEntryCommandHandler(IBackgroundJobClient jobClient, IAcornBoxDbContext dbContext)
 {
     _jobClient = jobClient;
     _dbContext = dbContext;
 }
Пример #45
0
 public TaskProcessor(string connectionString, IBackgroundJobClient backgroundJobs)
 {
     _connectionString = connectionString;
     _backgroundJobs   = backgroundJobs;
     _taskDataService  = new FinanceAPIMongoDataService.DataService.TaskDataService(_connectionString);
 }
Пример #46
0
 public DriftScheduler(IBackgroundJobClient backgroundJobs, DriftClientConfig driftConfig, ILogger <DriftScheduler> logger)
 {
     _backgroundJobs = backgroundJobs;
     _driftConfig    = driftConfig;
     _logger         = logger;
 }
Пример #47
0
 public Jobs(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
Пример #48
0
 public ReportsController(IReportRunner reportRunner, IOptions <Config> configOptions, UloDbContext db, ICacher cacher, PortalHelpers portalHelpers, UserHelpers userHelpers, ILogger <ReportsController> logger, IRecurringJobManager rjm, IBackgroundJobClient backgroundJobClient)
     : base(db, cacher, portalHelpers, userHelpers, logger)
 {
     ReportRunner        = reportRunner;
     ConfigOptions       = configOptions;
     RJM                 = rjm;
     BackgroundJobClient = backgroundJobClient;
 }
 public ValuesController(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
        public void Setup()
        {
            _client = Mock.Of<IBackgroundJobClient>();

            _context = Mock.Of<IMetadataContext>();
            _scheduledImages = Mock.Of<DbSet<ScheduledImage>>();

            _postNotificationSender = Mock.Of<IPostNotificationSender>();

            var imageMetadataTags = Mock.Of<DbSet<ImageMetadataTag>>();
            Mock.Get(_context).Setup(ctx => ctx.ScheduledImages).Returns(_scheduledImages);
            Mock.Get(_context).Setup(ctx => ctx.ImageMetadataTags).Returns(imageMetadataTags);
        }