Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add polling for job scheduler #527

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@

namespace StamAcasa.Api.BackgroundServices
{
using Microsoft.Extensions.DependencyInjection;

public class UserManagementService : BackgroundService
{
private readonly ILogger<UserManagementService> _logger;
private readonly IQueueService _queueService;
private readonly IUserService _userService;
private readonly IServiceProvider _serviceProvider;

public UserManagementService(IQueueService queueService, IUserService userService, ILogger<UserManagementService> logger)
public UserManagementService(IQueueService queueService, IServiceProvider serviceProvider, ILogger<UserManagementService> logger)
{
_queueService = queueService;
_userService = userService;
_serviceProvider = serviceProvider;
_logger = logger;
}

Expand All @@ -31,9 +33,10 @@ public override Task StartAsync(CancellationToken cancellationToken)
{
try
{
var userService = _serviceProvider.GetService<IUserService>();
_logger.LogInformation($"Will soft delete user with sub= {request.Sub}");

await _userService.MarkUserAsDeleted(request.Sub);
await userService.MarkUserAsDeleted(request.Sub);

_logger.LogInformation($"Done soft delete of user with sub= {request.Sub}");
}
Expand Down