Try your search with a different keyword or use * as a wildcard.
using Nop.Core.Domain.Customers;
using Nop.Services.ScheduleTasks;
namespace Nop.Services.Customers;
///
/// Represents a task for deleting guest customers
///
public partial class DeleteGuestsTask : IScheduleTask
{
#region Fields
protected readonly CustomerSettings _customerSettings;
protected readonly ICustomerService _customerService;
#endregion
#region Ctor
public DeleteGuestsTask(CustomerSettings customerSettings,
ICustomerService customerService)
{
_customerSettings = customerSettings;
_customerService = customerService;
}
#endregion
#region Methods
///
/// Executes a task
///
public async System.Threading.Tasks.Task ExecuteAsync()
{
var olderThanMinutes = _customerSettings.DeleteGuestTaskOlderThanMinutes;
// Default value in case 0 is returned. 0 would effectively disable this service and harm performance.
olderThanMinutes = olderThanMinutes == 0 ? 1440 : olderThanMinutes;
await _customerService.DeleteGuestCustomersAsync(null, DateTime.UtcNow.AddMinutes(-olderThanMinutes), true);
}
#endregion
}